Completed exercise with different coding