Rewrite of the Gryffin Engine