modifying js to deal with multiple cases