improved formatting and comments