Refactor plugin install function to ease wsgi object exposure