Huge refactor to make the InsertWorksProofs file smaller