Cleaned up to improve performance
Removed unneccessary initialization of entityMap
ADD: calling System.gc() every 1024 wraps