Some refactor, also new function returning population average

Added new function populationAverage(), refactor functions, new
namespace mutation