test and refactor