hw5 as a starting point