Added check to ensure files exists