Changed `formatter` signature for easier customizing.
Added more tests.