exec was not working well, and was a hack anyway - more code but less cruft