Cleanup algorithm structure