Carly's second code with comments