cleaned up python code for public contribution
basic pstream working