Clean up javascript a bit