completed second part of assignment3