code formatting
logic cleanup

added $app->request as an $_REQUEST array