use fileOpen function
removed old file handling code