add missing 'var' decleraions and some comments