clean queries and improve calculation override