Refactor update script to class and add unit test