Formatting, cleanup and a couple of useful methods