added handling for empty tokens