refactor update so that error checking goes in the right order...