cleaned up and added weights according to standard deviation