Minor refactoring; cleaning up