Updated script in OOP style