Code formatting logic