added method to check for file existence