added totalRecords method

I'm not too sure about the adding a global variable to hold the records. Let me know if I should change it!