Code dump! Built basics, still very messy and undocumented code.

Will promise to start cleaning up.