minor changes to remove unused variables, added an assert, added col
checking.