Code review

Don't merge, I'm using this as a code review branch.