This is used below as well, maybe move out into a fn?