Moves update code into a separate method.
Merge pull request #12 from vladlosev/misc-update-refactor

Moves update code into a separate module.