Refactor and code base cleanup.