added some statistics tracking