changed algorithm behaviour, still problem getting optimal