Better way to handle the file input