codes from teacher + assignment