added a hashmap for collision detection