Rewrote statistics collection. Added function to check for existence of a redis key.