improving javascript