Random fixes, cleaned some code up, a bit more work to do