polished code added hit/miss count