added if statements to check existance of files