changed loops for hint