using assignment3 as a starting point