Basic cleanup / refactoring