better js code