Added corner cases and tests for Exercise 1.11.