quite close to old plugin