improve my javascript