finished second part of assignment