Refactor tensor

Work in progress:

 * Refactor tensor so that it plays better with tensor products of superoperators (see PR #99)
 * Simplify and cleanup the code