javascript branch cleanup