refactor to match spec