first pass through with js, still some kinks to work out