refactored and fixed old tests