performance stats and general cleanup