Fixed some eis interface and multi-threading issues and cleaned up code.