Optimized types and casting