refactor main plugin file as singleton