Updated to grab entity manager out of globals