code updated for use on kt4