improve javascript style