Make completion more robust, commenting, and cleanup