Added structures, macros and function prototypes