somewhat refactored chrome extension with a new factory