Add unit-tests and some refactoring