Structs!

Oh my god the code is messy. TODO clean it up...