Compiles. Runs. Bugs. Will work on the latter later.