cleaned up javascript a little