Cleanups + refactoring