Ex1: Joel's attempt
EX1: fixed EX1
EX2: Joel's Solution