Partly cleanup

Clean up some code, but could need some more work.