More fixes and formatting