Javascript style improvement