Small optimizations

Relevant when using a huge number of restraints