syntax fixes, optimizations, etc