Source code from an online tutorial from the new boston (may have some typing errors)