Maybe take a hash as input? If id is set, use it. If not, check for app.