Much cleaner plugin code