Converted to plugin

Made this a plugin, added function prefixes.