works for reading from file and theorems

Second double space check is still commented out though