optimizations and syntax cleanups