Javascript code style improvements