The trader and miner is paying down debts and is getting its house in order