new tests added. some refactoring.