This program was written in mips.