Some tests added. Small refactoring