Formatting and code cleanup