listed companies

Investing in shares on the stockmarket

Q: I have been investing in shares for the past two years and I have earned a good amount of profit so far. When investing, I avoid buying shares in companies such as banks, insurance companies, companies manufacturing and selling liquor, etc. I only invest in companies of which the main business is halaal. However, when I look at the financial statements of the companies, I find that these companies do have interest dealings and some other haraam elements in their operation. Will it be permissible for me to invest in these companies? Also, will the profits earned through the investment be halaal?