formatting and code cleanup