this is the modified assn-2 for R