partialy implemented pset4.