completed exercise 2 of Addy Osmani book