Various optimalizations