Modified to add new checks
Modified for HW3 Part 3