made some variables const and used a strong eq condition