mod_rayo: refactor