Tweaked code, fixed bug.