some cleanup of algorithms