modified for HW4 with style changes