Cleanups + refactoring.