Tidy code, renaming and moving stuff.