working out js issues