performance tuning, cleanup