switch labels, clean up javascript a bit