UNTESTED: add blink generator and nearest neighbors code