Inserted some new functions into iotools.py