Move receiving file processing function to separate function
Add missing semicolon