working version of problem