Rewritten to python

Like we discussed I rewrote the script to python. Can be run aside of fix.sh