Fix #140 and #144. Rewriting first candidate mapping algorithm. deleting parts that may be unnecessary.