adding count and check functionality