Rearrange order of functions and tidy.