exercise 1.11
exercise 1.12 draft
refactoring and correct a bug in test