added a new class called pool to replace the entity arraylist