Test and refactor