Extension too time-consuming, trying a better algorithm instead