Tweaked a little to improve the performance