added points calculation in query