Automatic formatting and clean-up