minor optimizations

shaved off a few seconds, still debugging a MEX solution, still have a
few more things to try