Added activeness check to algorithm