Misc fixes and cleaning