This is a rewrite of my plugin Custom Gavity