add stat logic