Added function for checking whether file exists.