Could all of this have been avoided with good accounting / tax advice to begin with? I don't mean to be that person that gives 20/20 hindsight, but this is the sort of legal and tax problem that gets many startups into trouble. A lot of startups just wing it with legal and tax advice and end up paying more in the long run with tax liabilities and legal problems.