Refactor/add more unit test