Integrated new speed algorithm and commented out unused functions/variables