First test and some refactoring