Nums prettify

Refactored implementation of prettifying code and added helper method that allows us to use the linenums functionality.