basically got it working.  however it doesn't seem to work every time…….  i commented out all the flash messages but the logic seems to be working.