update code so tests pass