Minor tweaks to slightly improve efficiency and get rid of a few useless lines of code.