added controller methods and hooked up to query page