Cleanup table javascript a bit