Allow for greater flexibility
some refactoring, new tests