Fixes algorithm #28