Implement mapInvoke with tests

Closes #13