cleanup and tuning