more corrections and test refactoring