updates and optimizations