changed database query