Added code to handle revisions