Fix #269

Shorten most primitives where possible. Also optimize some edge cases.