code formatting and cleaning