rewrote app to be wsgi compliant