moved enums out of the structs and all declarations to the begin of functions