added more code to refine the production version of plugin