better js handling