A lot of work on vectors in particular.

Refactoring, documentation, removing unnecessary functions.