Removed duplicated code from update method