test refactor and errors