Heavy optimizations

I realized that the function that took most time was the remove function, so i modified the remove function to remove objects by their iterators instead. Much faster...