solved prob3 with tests