Update functions

Small optimalizations (untested)