added logging, modified index