Cleanup of Janrain code and related web2py patch