added some debug lines and fixed index issue with highlighting