add and refactor tests