Added second piece of implimentation to algorithm (first stable version of algorithm, cimpiles without errors)