Added graceful file checking.