Added optimizeCode(algorithm) function