Updated code to work on J2.5 and J3