experimental matrix multiplication implementation
nicer code structure
added type parameters => more flexibility, slight restructuring