Add inline documentation
Restructure, make matrix an own npm module.