keyify block uses self.m
finished converting bfs to only keyified stuff