Added most of the basic code

Lots of trouble with accidentally reverting and rolling back the repo,
hopefully everything's there.