final optimizations