Increase test coverage and formatter consistency.
Merge pull request #4 from grepory/master

Bug fixes, tests