Functional settings page. Bugfixes and cleaning.

- Refactored content.js
- Fixed a bug that cause add-channel event to not be send properly to
  main.js from content.js