breaking some stuff up to make it work better for the chrome extension