Restored to previous version of algorithm