working on chop function