review fixes and optimizations