Refactor out more code from the 'verify' file