Tweaked up some code