rewrite to use restas' routing