Fixed a few bugs and rewrote some bash scripts in Python.