Terminating correctly
Refactor