Format and optimize