Language optimizations

Fixes #1259