Added more stat tracking and did big optimizations