Debugged: Changed iterator to const_iterator