Made some small changes in the interest of performance