Added typedefs and basic definitions after some help by Freek