tried to refactor to use shared functions, weird things happened. back to dupe functions in background and options