rough version of problem 4