separated different update functions
cleaned up some code