Added justified alignment support, refactoring

Other general tidying such as commenting and making method names more
readable.