More work + refactoring