Code formatting fixes for key functions