Revert 'Removed optimizations'