Add tab support and refactor the plugin file