general cleanup and tuning