added a destroy method and restructured the window resize and custom event callbacks so that unbinding them doesn't have any side effects to other plugins that binds callbacks to the same events