Update plugin.sh with new helper functions