Refactor EntityLoader