add getLastAcutalQuery, refactory

add getLastActualQuery() function
refactorying a member function to a class function