minor updates and refactoring