Add better handling of files