Rough coded keep counts function keep sample debug