added optimizations (but disabled)