implemented shingle algorithm