revised app, modified controllers and queries