More updates and refactoring