Changes for searching max anf min element