Modified csv function to include filename