finish off changes from yesterday, misc refactor