Finished first part of homework 4