Restructured things and added tests for prettyPrinting