Added "GetFactionData" function and made other improvements to faction code