Refactor queue registering