Should fix issue 31 and 32

Should fix concurrent modification error from removing keys from hashmap while iterating through it.