added update, refactoring, and fixes