added eric's code