added total noteCount to sql query_notes() function