Simplified code with typedefs