Added code to find the map and mode of samples