Initial code commit (WIP)

Yes, WIP. A lot of things here may be weird or broken.