Allow passing method to free contents of hashmap
Track messages by source for faster removal