code refactoring
start writing tests