refactor faction parsing