My company has been licensing a commercial application to fulfill our need for the past few years. The programmers (myself included) have been modifying (with permission) the software to better suit our needs. Now we're talking about replacing the licensed software with an in-house solution we create ourselves. We want to be fair (and legal) in our dealings, but we've all been influenced by the ideas we've had while hacking.
I'm sure this isn't the first time this has happened, and I wondered if there are common practices or development patterns which are followed in such situations?