Fixed vector::erase misuse.
Fixed OSX not compiling.
Cleared warnings.