added statistics gathering