Initial fixes after refactoring