moth: fix algorithm
moth: remove debug