works for prob 4