Tweakings

Just tweaked function a bit so it would work.