Optimizations & cleanup