updated code to get plugin to work