Made some minor tweaks to clean up code