Added a method for tidying the algorithm and fixed logic errors in
fluctuation of markets.