mor tests and refactoring