better express algorithm