Minor improvements to the accounting code