Converted functions in plugin to scripts for portability