Small refactor plus starting more testing