Base files

Warning: This is rough. Lots of stuff still needs to be optimized and
cleaned up, but here's where it's at right now.