Everyone knows Dickens’ famous opening from A Tale of Two Cities. But “It was the best of times, it was the worst of times..." is only the beginning of the line. The sentence continues: “it was the age of wisdom, it was the age of foolishness…”

It’s that second part that makes the quote an apt metaphor for life in a startup - and a dire warning to entrepreneurs.

When you’re starting a company, your job is to be super-smart and achieve the best of times, while avoiding the dumb mistakes that can lead to the worst of times. And that means not getting so carried away with the excitement of building a company and a product that you neglect the legal basics.

To help you avoid walking into legal landmines, we turned to entrepreneur and attorney Charley Moore, founder and chairman of Rocket Lawyer, for his perspective on the most common - and most dangerous - legal mistakes that startups make, and how to avoid them.

Stupid mistake #1: Failure to incorporate

While most businesses in the U.S. are sole proprietorships — meaning there’s no legal distinction between the business and the owner — this business structure has major disadvantages and poses major risks to your personal assets (car, house, bank accounts), which can all be “lost” if the company gets sued.

If you incorporate, your company becomes a separate legal entity that conducts business, generates income and assumes its own tax and legal liabilities. Besides reducing your personal tax bill as an owner, incorporating can reduce risk to your personal assets. It’s not complicated or expensive to incorporate. (There are plenty of places online where you can incorporate your business, including Rocket Lawyer, Incorporate.com and Legal Zoom, among others.)

Another common mistake is choosing the wrong business entity. There are various business entities to choose from, such as C corporation, S corporation, LLC and nonprofit. Each corporate structure has different implications when it comes to expenses and procedures, legal liability, taxation and fundraising, so consider your present and future requirements when making your decision.

This is not a decision to make on your own. Make sure to speak to both an attorney and a tax advisor to get the big picture on what’s best for your situation.

Stupid mistake #2: Not protecting your intellectual property

It doesn’t do you much good to come up with the next big thing if you don’t control its ownership. It’s essential to protect your intellectual property, or you’ll run the risk that someone could steal or copy your idea, brand or product after you’ve put money and effort into it. If you fail to assert your rights to your intellectual property, you may inadvertently surrender your claim to essential components of your business’s success. And that could be the end of your startup. There are four types of intellectual property: trademarks, patents, trade secrets and copyrights.

A trademark is a symbol that distinguishes and identifies your startup’s product. You can acquire trademark rights through the consistent use of a mark even if that trademark is not registered. However, when push comes to shove and you need to enforce your trademark rights, it is helpful to have that mark registered with the U.S. Patent Office (USPTO).

Copyrights protect written works and apply without registration. To help protect the rights of your copyright, mark your written works with a copyright symbol. For extra protection, you can also register your copyright with the USPTO. In the event that someone infringes on your rights, you or your attorneys can send copyright notices and cease-and-desist notices to try and get the offenders to stop.

Trade secrets are your business’s proprietary practices and/or knowledge, and they can be highly valuable. Think of Coca-Cola’s secret formula. The company has successfully kept it under wraps for more than a century, and you should strive to take the same care with your company’s trade secrets. It’s actually fairly straightforward to get legal protections for your trade secrets. The first step is to ask anyone who has access to your proprietary knowledge to sign non-compete and non-disclosure agreements before you reveal anything.

Patents must be applied for, and although the process may take several years, you can generally note “patent pending” to communicate to others that a patent has been applied for. It’s also smart to include provisions in employment agreements that specify who owns any patents developed using company resources.

Stupid mistake #3: Not following employment best practices

Lawsuits by unhappy employees can kill a startup before it even gets off the ground. There’s also the risk that employees could leave your business, taking clients or ideas with them. Protect yourself from these risks by having new employees sign an employment agreement, where you clearly lay out your employees’ responsibilities, rights and obligations.

If you are hiring independent contractors or consultants, your agreement should also include their service fees, length of the agreement, completion date and what the consequences are for a breach of contract.

When putting together these agreements, don’t forget to include an arbitration clause. It could keep you out of court in the event of a conflict - and saving those legal fees could be the difference between success and failure.

Stupid mistake #4: Not getting agreements in writing

Whenever there’s an agreement of any kind, you should write a contract and get all of the parties to sign it. This helps make sure everyone is on the same page and, most importantly, creates a written record of the agreement. Hopefully nothing will go wrong, but if you have the agreement in writing, you’ll have a much easier time proving your case in court (or in private arbitration, which you can stipulate in your agreement as well).

Remember, written agreements protect everyone involved. Although they may take a short amount of your time upfront, they can save you thousands of dollars in legal expenses and losses at a later date if a dispute comes up.

When you’re in the throes of a startup, it’s all too easy to make stupid legal mistakes, thinking you’ll get around to doing it right eventually. More likely, you won’t think of it again until it’s too late to save your company.