refactor revision handling