separated different update functions
cleaned up some code
Merge branch 'develop'