Cleanup + optimizations