clean up exec() code a little