Initial code commit

Ugly, but it gets the job done. Kind of.