add function find_least etc; need debug