algorithm draft done