New test suit and more refactoring