Any code that you copied from the oauth2_token view should be refactored into functions so that these views can share code rather than copy/paste.