Moved several pieces into custom objects, added my own objects.

Trying to preserve as much of the original project structure as possible
so that rebase from upstream master is easier.