More updates and refactoring.