Optimize object literal

Optimizations inspired by #23