finding local maximum implemented