Working version of standard deviation function