adding some code for stats