speed code added to midbrain, but still a couple errors with the main code.