new algorithm based on 13939992d compiles