little better js handling