Fixes and refactors the update method.