Some basic improvements to the refactor branch