Reworked script using J50npi