solved prob4 with tests