Update runBetter.m

some parts of the code were converted to functions