Clean-up of algorithms