adding refactored empirecore.js