Made 5.2 compliant. Did some API changes for better control.