update and cleanup/refactoring