Refactor steam.py, add extensive tests