adds debug
non-goroutine version
add benchmark function