The company's worst days might be behind it.