updated with full checks for hw3