Cleaned up code - changed to using classes instread of structs