initial commit of median code