re-ordered plugin code to separate initialisation code from Resize function