adding the logic to deal with plugins