Lonely planet code exercise