Rewrote/fixed input redirection - Gary