Fix autosuggestion left behind

This is a fix for the issue #561. I also took the liberty to clean up some comments while navigating through the code.