Modified for assignment 3