Modification of Dr. Ghafoor's simulator code for my master's thesis research.