Implement even more minimal algorithm

Signed-off-by: Michal Novotny <mignov@gmail.com>