minor changes, revert back to stdin for input