cleaned up with typedefs