Auto-completion cleanup

Simplified completion parsing by getting rid of flatten/slice sequence.