Merged some of the smaller changes from the re-write