Fixed plugin so that it complies with the latest PlatformManager interface.
Other minor improvements on code clarity.