btc-inventory: some refactoring