Cleanup Mips code and rename some variables. Patch by Jack Carter