Better data handling and return values.  Also corrected a few minor errors in the PIP script.