Added iterating process to get median and standard deviation