this logic should stay in FileBased...