Changed over everything to typedefs and structs, not quite working yet