Split nitpretty

Split the nitpretty module into lib and tool

Fixes #836