solved prob5 with tests