Re-coded file reader onload function