cleaned up the base js quite a bit, ready to inject actual code