Added comments and improved formatting options