These are revised codes for assignment 2.