Improved formatting and code documentation