Implement update

Implement update method, did some refactoring to eliminate
code duplication