Applied base codes from project2 to project3