Add checks to code to handle several different file input scenarios.