First go at refactoring contentscript into subcomponents