Rewrite to use primus