changed to work as a plugin