Dontrell94's changes

Made some code cleanup and optimization tweaks.