Refactoring & cleanup.