corrected logic error, resubmitting. Use this one