Removed DISTINCT from getAvailableTasks query