Writing the plugin's core functions