More fixes and cleanup