Added exists method to check if a file exists