added select query to functionality