More tweaks to loadProgramIntoMemory() function. Still need more tweaking.