Move format into separate module
Merge pull request #534 from mroderick/extract-format-method

Move format into separate module