Cleanups, refactoring