Optimized parts of extension algorithm