Tweaked a few things to improve performance