Beginning code cleanup. Everything is broken at the moment.