Added condition for output form and pre query.