Tweaked the code