some basic optimizations