XEM Implementation: More fixes
* More fixes
* Cleaned up some code