Code for finding median added