Complete initial algorithm