refactor to detect missing container and split files apart