Add file exist checking and exceptions.