update change function to calculate based on unspent input