Modified for assignment2