add automatic getting of number of records