Update functions

Small optimalizations (untested)
Merge pull request #13 from CurlyMoo/patch-8

Update functions