BG:EE compatibility

Added BG:EE compatibility. Based on latest version on github -- merge this before merging Isaya's pull request, as theirs needs to be applied on top of this version.