resolved exercise 7 from ALG1, fixes #1