added task functionality and to fix the query issue