modified writer and cleaned up predit.py