172 vector function

Preliminary code review of new functions. Tests will be added once I know the implementation is correct.
Something wrong with indentation.