Implemented pseudocode for 'processFile'