Code formatting and cleanup