added functions to calculate accuracy