Working on converting orginal code