Hopefully fixes some, and some cleanup