From 4efaf1c28b3006e8b53ca25a3a5497a94ede911e Mon Sep 17 00:00:00 2001
From: David Sehnal <david.sehnal@gmail.com>
Date: Tue, 7 Nov 2017 17:31:40 +0100
Subject: [PATCH] Module refactoring

---
 src/apps/cif2bcif/converter.ts                |  2 +-
 src/apps/cif2bcif/field-classifier.ts         |  2 +-
 src/apps/domain-annotation-server/mapping.ts  |  2 +-
 src/apps/domain-annotation-server/schemas.ts  |  2 +-
 src/apps/domain-annotation-server/utils.ts    |  4 +--
 src/mol-base/utils/uuid.ts                    | 19 ----------
 .../_spec/equiv-index.spec.ts                 |  2 +-
 .../_spec/iterators.spec.ts                   |  0
 .../_spec/sort.spec.ts                        |  2 +-
 .../database.ts => mol-data/db.ts}            |  8 ++---
 .../db}/_spec/table.spec.ts                   |  0
 .../db}/column-helpers.ts                     |  0
 .../database => mol-data/db}/column.ts        |  2 +-
 .../database => mol-data/db}/database.ts      |  0
 .../database => mol-data/db}/table.ts         |  2 +-
 src/mol-data/index.ts                         | 12 +++++++
 .../integer.ts => mol-data/int.ts}            | 12 +++----
 .../int}/_spec/interval.spec.ts               |  0
 .../int}/_spec/linked-index.spec.ts           |  0
 .../int}/_spec/ordered-set.spec.ts            |  0
 .../int}/_spec/segmentation.spec.ts           |  0
 .../int}/_spec/sorted-array.spec.ts           |  0
 .../int}/_spec/tuple.spec.ts                  |  0
 .../integer => mol-data/int}/impl/interval.ts |  0
 .../int}/impl/ordered-set.ts                  |  0
 .../int}/impl/segmentation.ts                 |  0
 .../int}/impl/sorted-array.ts                 |  3 +-
 .../integer => mol-data/int}/interval.ts      |  0
 .../integer => mol-data/int}/linked-index.ts  |  0
 .../integer => mol-data/int}/ordered-set.ts   |  0
 .../integer => mol-data/int}/segmentation.ts  |  0
 .../integer => mol-data/int}/sorted-array.ts  |  0
 .../integer => mol-data/int}/tuple.ts         |  2 +-
 .../collections => mol-data}/iterator.ts      |  0
 src/mol-data/util.ts                          | 15 ++++++++
 .../util}/chunked-array.ts                    |  0
 .../util}/equivalence-classes.ts              |  0
 .../util}/hash-functions.ts                   |  0
 .../collections => mol-data/util}/hash-set.ts |  0
 .../collections => mol-data/util}/sort.ts     |  0
 .../util}/unique-array.ts                     |  0
 src/mol-io/common/binary-cif/array-encoder.ts |  2 +-
 src/mol-io/reader/_spec/cif.spec.ts           |  2 +-
 src/mol-io/reader/_spec/column.spec.ts        |  2 +-
 src/mol-io/reader/cif/binary/field.ts         |  2 +-
 src/mol-io/reader/cif/binary/parser.ts        |  2 +-
 src/mol-io/reader/cif/data-model.ts           |  4 +--
 src/mol-io/reader/cif/schema.ts               |  2 +-
 src/mol-io/reader/cif/schema/dic.ts           |  2 +-
 src/mol-io/reader/cif/schema/mmcif.ts         |  2 +-
 src/mol-io/reader/cif/text/field.ts           |  2 +-
 src/mol-io/reader/cif/text/parser.ts          |  2 +-
 src/mol-io/reader/common/text/column/fixed.ts |  2 +-
 src/mol-io/reader/common/text/column/token.ts |  2 +-
 src/mol-io/reader/common/text/tokenizer.ts    |  2 +-
 src/mol-io/reader/gro/parser.ts               |  4 +--
 src/mol-io/reader/gro/schema.d.ts             |  2 +-
 src/mol-io/reader/mol2/schema.d.ts            |  2 +-
 src/mol-io/writer/cif/encoder.ts              |  4 +--
 src/mol-io/writer/cif/encoder/binary.ts       |  4 +--
 src/mol-io/writer/cif/encoder/text.ts         |  4 +--
 .../geometry/grid-lookup.ts                   |  0
 src/{mol-base => mol-math}/geometry/sphere.ts |  0
 .../geometry/transform.ts                     |  2 +-
 src/{mol-base => mol-math}/graph/graph.ts     |  0
 src/mol-math/linear-algebra.ts                |  8 +++++
 .../linear-algebra/3d.ts}                     | 11 +++---
 .../linear-algebra}/_spec/tensor.spec.ts      |  4 +--
 .../linear-algebra}/tensor.ts                 | 36 ++++++++++++++++---
 src/{mol-data => mol-model}/sequence/TODO     |  0
 src/{mol-data => mol-model}/structure.ts      |  0
 .../structure/_spec/atom-set.spec.ts          |  2 +-
 .../structure/export/mmcif.ts                 |  4 +--
 .../structure/model.ts                        |  0
 .../structure/model/format.ts                 |  0
 .../structure/model/formats/mmcif.ts          | 10 +++---
 .../structure/model/model.ts                  |  2 +-
 .../structure/model/properties/computed.ts    |  0
 .../model/properties/conformation.ts          |  4 +--
 .../model/properties/format-specific.ts       |  0
 .../structure/model/properties/hierarchy.ts   |  4 +--
 .../structure/model/properties/transforms.ts  |  0
 .../structure/model/types.ts                  |  2 +-
 .../structure/model/utils/hierarchy-keys.ts   |  4 +--
 .../structure/query.ts                        |  0
 .../structure/query/generators.ts             |  2 +-
 .../structure/query/predicates.ts             |  0
 .../structure/query/properties.ts             |  0
 .../structure/query/query.ts                  |  0
 .../structure/query/selection.ts              |  4 +--
 .../structure/structure.ts                    |  0
 .../structure/structure/atom.ts               |  2 +-
 .../structure/structure/atom/set.ts           |  2 +-
 .../structure/structure/atom/set/builder.ts   |  4 +--
 .../structure/structure/atom/set/impl.ts      |  6 ++--
 .../structure/atom/set/properties.ts          |  0
 .../structure/structure/operator.ts           |  2 +-
 .../structure/structure/structure.ts          |  4 +--
 .../structure/structure/unit.ts               |  2 +-
 src/{mol-data => mol-model}/volume/TODO       |  0
 .../_spec/string-builder.spec.ts              |  0
 src/{mol-base/utils => mol-util}/bit-flags.ts |  0
 src/{mol-base => mol-util}/computation.ts     |  4 +--
 src/mol-util/index.ts                         | 14 ++++++++
 src/{mol-base/utils => mol-util}/scheduler.ts |  0
 .../utils => mol-util}/string-builder.ts      |  0
 src/{mol-base/utils => mol-util}/time.ts      |  0
 src/mol-util/uuid.ts                          | 23 ++++++++++++
 src/perf-tests/chunked-array-vs-native.ts     |  2 +-
 src/perf-tests/cif-encoder.ts                 |  2 +-
 src/perf-tests/column.ts                      |  2 +-
 src/perf-tests/iterators.ts                   |  2 +-
 src/perf-tests/sets.ts                        |  4 +--
 src/perf-tests/sort.ts                        |  2 +-
 src/perf-tests/string-builder.ts              |  2 +-
 src/perf-tests/structure.ts                   |  6 ++--
 src/script.ts                                 |  4 +--
 tsconfig.json                                 |  8 +++--
 118 files changed, 210 insertions(+), 127 deletions(-)
 delete mode 100644 src/mol-base/utils/uuid.ts
 rename src/{mol-base/collections => mol-data}/_spec/equiv-index.spec.ts (89%)
 rename src/{mol-base/collections => mol-data}/_spec/iterators.spec.ts (100%)
 rename src/{mol-base/collections => mol-data}/_spec/sort.spec.ts (98%)
 rename src/{mol-base/collections/database.ts => mol-data/db.ts} (53%)
 rename src/{mol-base/collections/database => mol-data/db}/_spec/table.spec.ts (100%)
 rename src/{mol-base/collections/database => mol-data/db}/column-helpers.ts (100%)
 rename src/{mol-base/collections/database => mol-data/db}/column.ts (99%)
 rename src/{mol-base/collections/database => mol-data/db}/database.ts (100%)
 rename src/{mol-base/collections/database => mol-data/db}/table.ts (99%)
 create mode 100644 src/mol-data/index.ts
 rename src/{mol-base/collections/integer.ts => mol-data/int.ts} (50%)
 rename src/{mol-base/collections/integer => mol-data/int}/_spec/interval.spec.ts (100%)
 rename src/{mol-base/collections/integer => mol-data/int}/_spec/linked-index.spec.ts (100%)
 rename src/{mol-base/collections/integer => mol-data/int}/_spec/ordered-set.spec.ts (100%)
 rename src/{mol-base/collections/integer => mol-data/int}/_spec/segmentation.spec.ts (100%)
 rename src/{mol-base/collections/integer => mol-data/int}/_spec/sorted-array.spec.ts (100%)
 rename src/{mol-base/collections/integer => mol-data/int}/_spec/tuple.spec.ts (100%)
 rename src/{mol-base/collections/integer => mol-data/int}/impl/interval.ts (100%)
 rename src/{mol-base/collections/integer => mol-data/int}/impl/ordered-set.ts (100%)
 rename src/{mol-base/collections/integer => mol-data/int}/impl/segmentation.ts (100%)
 rename src/{mol-base/collections/integer => mol-data/int}/impl/sorted-array.ts (99%)
 rename src/{mol-base/collections/integer => mol-data/int}/interval.ts (100%)
 rename src/{mol-base/collections/integer => mol-data/int}/linked-index.ts (100%)
 rename src/{mol-base/collections/integer => mol-data/int}/ordered-set.ts (100%)
 rename src/{mol-base/collections/integer => mol-data/int}/segmentation.ts (100%)
 rename src/{mol-base/collections/integer => mol-data/int}/sorted-array.ts (100%)
 rename src/{mol-base/collections/integer => mol-data/int}/tuple.ts (98%)
 rename src/{mol-base/collections => mol-data}/iterator.ts (100%)
 create mode 100644 src/mol-data/util.ts
 rename src/{mol-base/collections => mol-data/util}/chunked-array.ts (100%)
 rename src/{mol-base/collections => mol-data/util}/equivalence-classes.ts (100%)
 rename src/{mol-base/collections => mol-data/util}/hash-functions.ts (100%)
 rename src/{mol-base/collections => mol-data/util}/hash-set.ts (100%)
 rename src/{mol-base/collections => mol-data/util}/sort.ts (100%)
 rename src/{mol-base/collections => mol-data/util}/unique-array.ts (100%)
 rename src/{mol-base => mol-math}/geometry/grid-lookup.ts (100%)
 rename src/{mol-base => mol-math}/geometry/sphere.ts (100%)
 rename src/{mol-base => mol-math}/geometry/transform.ts (91%)
 rename src/{mol-base => mol-math}/graph/graph.ts (100%)
 create mode 100644 src/mol-math/linear-algebra.ts
 rename src/{mol-base/math/linear-algebra-3d.ts => mol-math/linear-algebra/3d.ts} (98%)
 rename src/{mol-base/math => mol-math/linear-algebra}/_spec/tensor.spec.ts (98%)
 rename src/{mol-base/math => mol-math/linear-algebra}/tensor.ts (82%)
 rename src/{mol-data => mol-model}/sequence/TODO (100%)
 rename src/{mol-data => mol-model}/structure.ts (100%)
 rename src/{mol-data => mol-model}/structure/_spec/atom-set.spec.ts (99%)
 rename src/{mol-data => mol-model}/structure/export/mmcif.ts (98%)
 rename src/{mol-data => mol-model}/structure/model.ts (100%)
 rename src/{mol-data => mol-model}/structure/model/format.ts (100%)
 rename src/{mol-data => mol-model}/structure/model/formats/mmcif.ts (96%)
 rename src/{mol-data => mol-model}/structure/model/model.ts (95%)
 rename src/{mol-data => mol-model}/structure/model/properties/computed.ts (100%)
 rename src/{mol-data => mol-model}/structure/model/properties/conformation.ts (88%)
 rename src/{mol-data => mol-model}/structure/model/properties/format-specific.ts (100%)
 rename src/{mol-data => mol-model}/structure/model/properties/hierarchy.ts (95%)
 rename src/{mol-data => mol-model}/structure/model/properties/transforms.ts (100%)
 rename src/{mol-data => mol-model}/structure/model/types.ts (99%)
 rename src/{mol-data => mol-model}/structure/model/utils/hierarchy-keys.ts (97%)
 rename src/{mol-data => mol-model}/structure/query.ts (100%)
 rename src/{mol-data => mol-model}/structure/query/generators.ts (99%)
 rename src/{mol-data => mol-model}/structure/query/predicates.ts (100%)
 rename src/{mol-data => mol-model}/structure/query/properties.ts (100%)
 rename src/{mol-data => mol-model}/structure/query/query.ts (100%)
 rename src/{mol-data => mol-model}/structure/query/selection.ts (97%)
 rename src/{mol-data => mol-model}/structure/structure.ts (100%)
 rename src/{mol-data => mol-model}/structure/structure/atom.ts (96%)
 rename src/{mol-data => mol-model}/structure/structure/atom/set.ts (96%)
 rename src/{mol-data => mol-model}/structure/structure/atom/set/builder.ts (95%)
 rename src/{mol-data => mol-model}/structure/structure/atom/set/impl.ts (99%)
 rename src/{mol-data => mol-model}/structure/structure/atom/set/properties.ts (100%)
 rename src/{mol-data => mol-model}/structure/structure/operator.ts (91%)
 rename src/{mol-data => mol-model}/structure/structure/structure.ts (95%)
 rename src/{mol-data => mol-model}/structure/structure/unit.ts (98%)
 rename src/{mol-data => mol-model}/volume/TODO (100%)
 rename src/{mol-base/utils => mol-util}/_spec/string-builder.spec.ts (100%)
 rename src/{mol-base/utils => mol-util}/bit-flags.ts (100%)
 rename src/{mol-base => mol-util}/computation.ts (99%)
 create mode 100644 src/mol-util/index.ts
 rename src/{mol-base/utils => mol-util}/scheduler.ts (100%)
 rename src/{mol-base/utils => mol-util}/string-builder.ts (100%)
 rename src/{mol-base/utils => mol-util}/time.ts (100%)
 create mode 100644 src/mol-util/uuid.ts

diff --git a/src/apps/cif2bcif/converter.ts b/src/apps/cif2bcif/converter.ts
index 5083500e4..b663a301e 100644
--- a/src/apps/cif2bcif/converter.ts
+++ b/src/apps/cif2bcif/converter.ts
@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import Iterator from 'mol-base/collections/iterator'
+import Iterator from 'mol-data/iterator'
 import CIF, { Category } from 'mol-io/reader/cif'
 import * as Encoder from 'mol-io/writer/cif'
 import * as fs from 'fs'
diff --git a/src/apps/cif2bcif/field-classifier.ts b/src/apps/cif2bcif/field-classifier.ts
index 0fe447382..145cdc6f9 100644
--- a/src/apps/cif2bcif/field-classifier.ts
+++ b/src/apps/cif2bcif/field-classifier.ts
@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Column } from 'mol-base/collections/database'
+import { Column } from 'mol-data/db'
 import { Field } from 'mol-io/reader/cif/data-model'
 import { FieldDefinition, FieldType } from 'mol-io/writer/cif/encoder'
 
diff --git a/src/apps/domain-annotation-server/mapping.ts b/src/apps/domain-annotation-server/mapping.ts
index 419e4c270..da87d9b46 100644
--- a/src/apps/domain-annotation-server/mapping.ts
+++ b/src/apps/domain-annotation-server/mapping.ts
@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Table } from 'mol-base/collections/database'
+import { Table } from 'mol-data/db'
 import { CIFEncoder, create as createEncoder } from 'mol-io/writer/cif'
 import * as S from './schemas'
 import { getCategoryInstanceProvider } from './utils'
diff --git a/src/apps/domain-annotation-server/schemas.ts b/src/apps/domain-annotation-server/schemas.ts
index 90bbcba97..e6caffdac 100644
--- a/src/apps/domain-annotation-server/schemas.ts
+++ b/src/apps/domain-annotation-server/schemas.ts
@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Column } from 'mol-base/collections/database'
+import { Column } from 'mol-data/db'
 
 import Type = Column.Schema
 
diff --git a/src/apps/domain-annotation-server/utils.ts b/src/apps/domain-annotation-server/utils.ts
index 767de8fa4..7c3e91b2a 100644
--- a/src/apps/domain-annotation-server/utils.ts
+++ b/src/apps/domain-annotation-server/utils.ts
@@ -4,8 +4,8 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Table } from 'mol-base/collections/database'
-import Iterator from 'mol-base/collections/iterator'
+import { Table } from 'mol-data/db'
+import Iterator from 'mol-data/iterator'
 import * as Encoder from 'mol-io/writer/cif'
 
 function columnValue(k: string) {
diff --git a/src/mol-base/utils/uuid.ts b/src/mol-base/utils/uuid.ts
deleted file mode 100644
index 29c7d24de..000000000
--- a/src/mol-base/utils/uuid.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright (c) 2017 mol* contributors, licensed under MIT, See LICENSE file for more info.
- *
- * @author David Sehnal <david.sehnal@gmail.com>
- */
-
-import now from './time'
-
-export default interface UUID extends String { '@type': 'uuid' }
-
-export function newUUID(): UUID {
-    let d = (+new Date()) + now();
-    const uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
-        const r = (d + Math.random()*16)%16 | 0;
-        d = Math.floor(d/16);
-        return (c==='x' ? r : (r&0x3|0x8)).toString(16);
-    });
-    return uuid as any;
-}
\ No newline at end of file
diff --git a/src/mol-base/collections/_spec/equiv-index.spec.ts b/src/mol-data/_spec/equiv-index.spec.ts
similarity index 89%
rename from src/mol-base/collections/_spec/equiv-index.spec.ts
rename to src/mol-data/_spec/equiv-index.spec.ts
index d2d0a2856..9083c0145 100644
--- a/src/mol-base/collections/_spec/equiv-index.spec.ts
+++ b/src/mol-data/_spec/equiv-index.spec.ts
@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import EquivalenceClasses from '../equivalence-classes'
+import EquivalenceClasses from '../util/equivalence-classes'
 
 describe('equiv-classes', () => {
     it('integer mod classes', () => {
diff --git a/src/mol-base/collections/_spec/iterators.spec.ts b/src/mol-data/_spec/iterators.spec.ts
similarity index 100%
rename from src/mol-base/collections/_spec/iterators.spec.ts
rename to src/mol-data/_spec/iterators.spec.ts
diff --git a/src/mol-base/collections/_spec/sort.spec.ts b/src/mol-data/_spec/sort.spec.ts
similarity index 98%
rename from src/mol-base/collections/_spec/sort.spec.ts
rename to src/mol-data/_spec/sort.spec.ts
index 4bccb03cb..9d2a122cc 100644
--- a/src/mol-base/collections/_spec/sort.spec.ts
+++ b/src/mol-data/_spec/sort.spec.ts
@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import * as Sort from '../sort'
+import * as Sort from '../util/sort'
 
 function shuffle<T>(data: T, len: number, clone: (s: T) => T, swap: Sort.Swapper = Sort.arraySwap) {
     const a = clone(data);
diff --git a/src/mol-base/collections/database.ts b/src/mol-data/db.ts
similarity index 53%
rename from src/mol-base/collections/database.ts
rename to src/mol-data/db.ts
index 78818f8d8..367b533a0 100644
--- a/src/mol-base/collections/database.ts
+++ b/src/mol-data/db.ts
@@ -4,9 +4,9 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import Database from './database/database'
-import Table from './database/table'
-import Column from './database/column'
-import * as ColumnHelpers from './database/column-helpers'
+import Database from './db/database'
+import Table from './db/table'
+import Column from './db/column'
+import * as ColumnHelpers from './db/column-helpers'
 
 export { Database, Table, Column, ColumnHelpers }
\ No newline at end of file
diff --git a/src/mol-base/collections/database/_spec/table.spec.ts b/src/mol-data/db/_spec/table.spec.ts
similarity index 100%
rename from src/mol-base/collections/database/_spec/table.spec.ts
rename to src/mol-data/db/_spec/table.spec.ts
diff --git a/src/mol-base/collections/database/column-helpers.ts b/src/mol-data/db/column-helpers.ts
similarity index 100%
rename from src/mol-base/collections/database/column-helpers.ts
rename to src/mol-data/db/column-helpers.ts
diff --git a/src/mol-base/collections/database/column.ts b/src/mol-data/db/column.ts
similarity index 99%
rename from src/mol-base/collections/database/column.ts
rename to src/mol-data/db/column.ts
index 4a373652b..484411e6f 100644
--- a/src/mol-base/collections/database/column.ts
+++ b/src/mol-data/db/column.ts
@@ -5,7 +5,7 @@
  */
 
 import * as ColumnHelpers from './column-helpers'
-import Tensors from '../../math/tensor'
+import { Tensor as Tensors } from 'mol-math/linear-algebra'
 
 interface Column<T> {
     readonly '@type': Column.Type,
diff --git a/src/mol-base/collections/database/database.ts b/src/mol-data/db/database.ts
similarity index 100%
rename from src/mol-base/collections/database/database.ts
rename to src/mol-data/db/database.ts
diff --git a/src/mol-base/collections/database/table.ts b/src/mol-data/db/table.ts
similarity index 99%
rename from src/mol-base/collections/database/table.ts
rename to src/mol-data/db/table.ts
index a7178bc1c..65b7bd172 100644
--- a/src/mol-base/collections/database/table.ts
+++ b/src/mol-data/db/table.ts
@@ -5,7 +5,7 @@
  */
 
 import Column from './column'
-import { sortArray } from '../sort'
+import { sortArray } from '../util/sort'
 
 /** A collection of columns */
 type Table<Schema extends Table.Schema> = {
diff --git a/src/mol-data/index.ts b/src/mol-data/index.ts
new file mode 100644
index 000000000..1db90c26e
--- /dev/null
+++ b/src/mol-data/index.ts
@@ -0,0 +1,12 @@
+/**
+ * Copyright (c) 2017 mol* contributors, licensed under MIT, See LICENSE file for more info.
+ *
+ * @author David Sehnal <david.sehnal@gmail.com>
+ */
+
+import * as DB from './db'
+import * as Int from './int'
+import Iterator from './iterator'
+import * as Util from './util'
+
+export { DB, Int, Iterator, Util }
\ No newline at end of file
diff --git a/src/mol-base/collections/integer.ts b/src/mol-data/int.ts
similarity index 50%
rename from src/mol-base/collections/integer.ts
rename to src/mol-data/int.ts
index 1abd46acc..54c2795bb 100644
--- a/src/mol-base/collections/integer.ts
+++ b/src/mol-data/int.ts
@@ -4,12 +4,12 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import Interval from './integer/interval'
-import OrderedSet from './integer/ordered-set'
-import Segmentation from './integer/segmentation'
-import SortedArray from './integer/sorted-array'
-import Tuple from './integer/tuple'
-import LinkedIndex from './integer/linked-index'
+import Interval from './int/interval'
+import OrderedSet from './int/ordered-set'
+import Segmentation from './int/segmentation'
+import SortedArray from './int/sorted-array'
+import Tuple from './int/tuple'
+import LinkedIndex from './int/linked-index'
 import Iterator from './iterator'
 
 export { Interval, OrderedSet, Segmentation, SortedArray, Tuple, LinkedIndex, Iterator }
\ No newline at end of file
diff --git a/src/mol-base/collections/integer/_spec/interval.spec.ts b/src/mol-data/int/_spec/interval.spec.ts
similarity index 100%
rename from src/mol-base/collections/integer/_spec/interval.spec.ts
rename to src/mol-data/int/_spec/interval.spec.ts
diff --git a/src/mol-base/collections/integer/_spec/linked-index.spec.ts b/src/mol-data/int/_spec/linked-index.spec.ts
similarity index 100%
rename from src/mol-base/collections/integer/_spec/linked-index.spec.ts
rename to src/mol-data/int/_spec/linked-index.spec.ts
diff --git a/src/mol-base/collections/integer/_spec/ordered-set.spec.ts b/src/mol-data/int/_spec/ordered-set.spec.ts
similarity index 100%
rename from src/mol-base/collections/integer/_spec/ordered-set.spec.ts
rename to src/mol-data/int/_spec/ordered-set.spec.ts
diff --git a/src/mol-base/collections/integer/_spec/segmentation.spec.ts b/src/mol-data/int/_spec/segmentation.spec.ts
similarity index 100%
rename from src/mol-base/collections/integer/_spec/segmentation.spec.ts
rename to src/mol-data/int/_spec/segmentation.spec.ts
diff --git a/src/mol-base/collections/integer/_spec/sorted-array.spec.ts b/src/mol-data/int/_spec/sorted-array.spec.ts
similarity index 100%
rename from src/mol-base/collections/integer/_spec/sorted-array.spec.ts
rename to src/mol-data/int/_spec/sorted-array.spec.ts
diff --git a/src/mol-base/collections/integer/_spec/tuple.spec.ts b/src/mol-data/int/_spec/tuple.spec.ts
similarity index 100%
rename from src/mol-base/collections/integer/_spec/tuple.spec.ts
rename to src/mol-data/int/_spec/tuple.spec.ts
diff --git a/src/mol-base/collections/integer/impl/interval.ts b/src/mol-data/int/impl/interval.ts
similarity index 100%
rename from src/mol-base/collections/integer/impl/interval.ts
rename to src/mol-data/int/impl/interval.ts
diff --git a/src/mol-base/collections/integer/impl/ordered-set.ts b/src/mol-data/int/impl/ordered-set.ts
similarity index 100%
rename from src/mol-base/collections/integer/impl/ordered-set.ts
rename to src/mol-data/int/impl/ordered-set.ts
diff --git a/src/mol-base/collections/integer/impl/segmentation.ts b/src/mol-data/int/impl/segmentation.ts
similarity index 100%
rename from src/mol-base/collections/integer/impl/segmentation.ts
rename to src/mol-data/int/impl/segmentation.ts
diff --git a/src/mol-base/collections/integer/impl/sorted-array.ts b/src/mol-data/int/impl/sorted-array.ts
similarity index 99%
rename from src/mol-base/collections/integer/impl/sorted-array.ts
rename to src/mol-data/int/impl/sorted-array.ts
index fe0d90565..f3147c708 100644
--- a/src/mol-base/collections/integer/impl/sorted-array.ts
+++ b/src/mol-data/int/impl/sorted-array.ts
@@ -4,8 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { sortArray } from '../../sort'
-import { hash3, hash4 } from '../../hash-functions'
+import { sortArray, hash3, hash4 } from '../../util'
 import Interval from '../interval'
 
 type Nums = ArrayLike<number>
diff --git a/src/mol-base/collections/integer/interval.ts b/src/mol-data/int/interval.ts
similarity index 100%
rename from src/mol-base/collections/integer/interval.ts
rename to src/mol-data/int/interval.ts
diff --git a/src/mol-base/collections/integer/linked-index.ts b/src/mol-data/int/linked-index.ts
similarity index 100%
rename from src/mol-base/collections/integer/linked-index.ts
rename to src/mol-data/int/linked-index.ts
diff --git a/src/mol-base/collections/integer/ordered-set.ts b/src/mol-data/int/ordered-set.ts
similarity index 100%
rename from src/mol-base/collections/integer/ordered-set.ts
rename to src/mol-data/int/ordered-set.ts
diff --git a/src/mol-base/collections/integer/segmentation.ts b/src/mol-data/int/segmentation.ts
similarity index 100%
rename from src/mol-base/collections/integer/segmentation.ts
rename to src/mol-data/int/segmentation.ts
diff --git a/src/mol-base/collections/integer/sorted-array.ts b/src/mol-data/int/sorted-array.ts
similarity index 100%
rename from src/mol-base/collections/integer/sorted-array.ts
rename to src/mol-data/int/sorted-array.ts
diff --git a/src/mol-base/collections/integer/tuple.ts b/src/mol-data/int/tuple.ts
similarity index 98%
rename from src/mol-base/collections/integer/tuple.ts
rename to src/mol-data/int/tuple.ts
index 86cf4ea6b..7967f45cf 100644
--- a/src/mol-base/collections/integer/tuple.ts
+++ b/src/mol-data/int/tuple.ts
@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { hash2 } from '../hash-functions'
+import { hash2 } from '../util'
 
 /**
  * Represents a pair of two integers as a double,
diff --git a/src/mol-base/collections/iterator.ts b/src/mol-data/iterator.ts
similarity index 100%
rename from src/mol-base/collections/iterator.ts
rename to src/mol-data/iterator.ts
diff --git a/src/mol-data/util.ts b/src/mol-data/util.ts
new file mode 100644
index 000000000..ab0c73fcf
--- /dev/null
+++ b/src/mol-data/util.ts
@@ -0,0 +1,15 @@
+/**
+ * Copyright (c) 2017 mol* contributors, licensed under MIT, See LICENSE file for more info.
+ *
+ * @author David Sehnal <david.sehnal@gmail.com>
+ */
+
+import ChunkedArray from './util/chunked-array'
+import EquivalenceClasses from './util/chunked-array'
+import HashSet from './util/hash-set'
+import UniqueArray from './util/unique-array'
+
+export * from './util/hash-functions'
+export * from './util/sort'
+
+export { ChunkedArray, EquivalenceClasses, HashSet, UniqueArray }
\ No newline at end of file
diff --git a/src/mol-base/collections/chunked-array.ts b/src/mol-data/util/chunked-array.ts
similarity index 100%
rename from src/mol-base/collections/chunked-array.ts
rename to src/mol-data/util/chunked-array.ts
diff --git a/src/mol-base/collections/equivalence-classes.ts b/src/mol-data/util/equivalence-classes.ts
similarity index 100%
rename from src/mol-base/collections/equivalence-classes.ts
rename to src/mol-data/util/equivalence-classes.ts
diff --git a/src/mol-base/collections/hash-functions.ts b/src/mol-data/util/hash-functions.ts
similarity index 100%
rename from src/mol-base/collections/hash-functions.ts
rename to src/mol-data/util/hash-functions.ts
diff --git a/src/mol-base/collections/hash-set.ts b/src/mol-data/util/hash-set.ts
similarity index 100%
rename from src/mol-base/collections/hash-set.ts
rename to src/mol-data/util/hash-set.ts
diff --git a/src/mol-base/collections/sort.ts b/src/mol-data/util/sort.ts
similarity index 100%
rename from src/mol-base/collections/sort.ts
rename to src/mol-data/util/sort.ts
diff --git a/src/mol-base/collections/unique-array.ts b/src/mol-data/util/unique-array.ts
similarity index 100%
rename from src/mol-base/collections/unique-array.ts
rename to src/mol-data/util/unique-array.ts
diff --git a/src/mol-io/common/binary-cif/array-encoder.ts b/src/mol-io/common/binary-cif/array-encoder.ts
index 13f70f180..344171b8a 100644
--- a/src/mol-io/common/binary-cif/array-encoder.ts
+++ b/src/mol-io/common/binary-cif/array-encoder.ts
@@ -7,7 +7,7 @@
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
 
-import ChunkedArray from 'mol-base/collections/chunked-array'
+import ChunkedArray from 'mol-data/util/chunked-array'
 import { Encoding, EncodedData } from './encoding'
 
 export interface ArrayEncoder {
diff --git a/src/mol-io/reader/_spec/cif.spec.ts b/src/mol-io/reader/_spec/cif.spec.ts
index 856e1e16f..90fae982a 100644
--- a/src/mol-io/reader/_spec/cif.spec.ts
+++ b/src/mol-io/reader/_spec/cif.spec.ts
@@ -7,7 +7,7 @@
 import * as Data from '../cif/data-model'
 import TextField from '../cif/text/field'
 import * as Schema from '../cif/schema'
-import { Column } from 'mol-base/collections/database'
+import { Column } from 'mol-data/db'
 
 const columnData = `123abc`;
 
diff --git a/src/mol-io/reader/_spec/column.spec.ts b/src/mol-io/reader/_spec/column.spec.ts
index f7df7dfc8..e9e31ca99 100644
--- a/src/mol-io/reader/_spec/column.spec.ts
+++ b/src/mol-io/reader/_spec/column.spec.ts
@@ -7,7 +7,7 @@
 
 import FixedColumn from '../common/text/column/fixed'
 import TokenColumn from '../common/text/column/token'
-import { Column, ColumnHelpers } from 'mol-base/collections/database'
+import { Column, ColumnHelpers } from 'mol-data/db'
 
 const lines = [
     '1.123 abc',
diff --git a/src/mol-io/reader/cif/binary/field.ts b/src/mol-io/reader/cif/binary/field.ts
index 5847e0ab3..89e2c47af 100644
--- a/src/mol-io/reader/cif/binary/field.ts
+++ b/src/mol-io/reader/cif/binary/field.ts
@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Column, ColumnHelpers } from 'mol-base/collections/database'
+import { Column, ColumnHelpers } from 'mol-data/db'
 import * as Data from '../data-model'
 import { EncodedColumn, decode } from '../../../common/binary-cif'
 import { parseInt as fastParseInt, parseFloat as fastParseFloat } from '../../common/text/number-parser'
diff --git a/src/mol-io/reader/cif/binary/parser.ts b/src/mol-io/reader/cif/binary/parser.ts
index c72a9f438..4f1b705eb 100644
--- a/src/mol-io/reader/cif/binary/parser.ts
+++ b/src/mol-io/reader/cif/binary/parser.ts
@@ -9,7 +9,7 @@ import { EncodedCategory, EncodedFile } from '../../../common/binary-cif'
 import Field from './field'
 import Result from '../../result'
 import decodeMsgPack from '../../../common/msgpack/decode'
-import Computation from 'mol-base/computation'
+import Computation from 'mol-util/computation'
 
 function checkVersions(min: number[], current: number[]) {
     for (let i = 0; i < 2; i++) {
diff --git a/src/mol-io/reader/cif/data-model.ts b/src/mol-io/reader/cif/data-model.ts
index 75805537f..417692342 100644
--- a/src/mol-io/reader/cif/data-model.ts
+++ b/src/mol-io/reader/cif/data-model.ts
@@ -4,8 +4,8 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Column } from 'mol-base/collections/database'
-import Tensor from 'mol-base/math/tensor'
+import { Column } from 'mol-data/db'
+import { Tensor } from 'mol-math/linear-algebra'
 
 export interface File {
     readonly name?: string,
diff --git a/src/mol-io/reader/cif/schema.ts b/src/mol-io/reader/cif/schema.ts
index 441f4082c..ef0b3f5e2 100644
--- a/src/mol-io/reader/cif/schema.ts
+++ b/src/mol-io/reader/cif/schema.ts
@@ -5,7 +5,7 @@
  */
 
 import * as Data from './data-model'
-import { Database, Table, Column, ColumnHelpers } from 'mol-base/collections/database'
+import { Database, Table, Column, ColumnHelpers } from 'mol-data/db'
 
 export function toDatabase<Schema extends Database.Schema, Frame extends Database<Schema> = Database<Schema>>(schema: Schema, frame: Data.Frame): Frame {
     return createDatabase(schema, frame) as Frame;
diff --git a/src/mol-io/reader/cif/schema/dic.ts b/src/mol-io/reader/cif/schema/dic.ts
index f9a934abd..48a73dd51 100644
--- a/src/mol-io/reader/cif/schema/dic.ts
+++ b/src/mol-io/reader/cif/schema/dic.ts
@@ -4,7 +4,7 @@
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
 
-import { Database, Column } from 'mol-base/collections/database'
+import { Database, Column } from 'mol-data/db'
 
 import Schema = Column.Schema
 import FP = Schema.FP
diff --git a/src/mol-io/reader/cif/schema/mmcif.ts b/src/mol-io/reader/cif/schema/mmcif.ts
index 59b31c101..5fec25ce3 100644
--- a/src/mol-io/reader/cif/schema/mmcif.ts
+++ b/src/mol-io/reader/cif/schema/mmcif.ts
@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Database, Column } from 'mol-base/collections/database'
+import { Database, Column } from 'mol-data/db'
 
 import Schema = Column.Schema
 import FP = Schema.FP
diff --git a/src/mol-io/reader/cif/text/field.ts b/src/mol-io/reader/cif/text/field.ts
index 1628da3e4..6d1888494 100644
--- a/src/mol-io/reader/cif/text/field.ts
+++ b/src/mol-io/reader/cif/text/field.ts
@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Column, ColumnHelpers } from 'mol-base/collections/database'
+import { Column, ColumnHelpers } from 'mol-data/db'
 import * as TokenColumn from '../../common/text/column/token'
 import { Tokens } from '../../common/text/tokenizer'
 import * as Data from '../data-model'
diff --git a/src/mol-io/reader/cif/text/parser.ts b/src/mol-io/reader/cif/text/parser.ts
index 0a3f13c24..064b014a9 100644
--- a/src/mol-io/reader/cif/text/parser.ts
+++ b/src/mol-io/reader/cif/text/parser.ts
@@ -26,7 +26,7 @@ import * as Data from '../data-model'
 import Field from './field'
 import { Tokens, TokenBuilder } from '../../common/text/tokenizer'
 import Result from '../../result'
-import Computation from 'mol-base/computation'
+import Computation from 'mol-util/computation'
 
 /**
  * Types of supported mmCIF tokens.
diff --git a/src/mol-io/reader/common/text/column/fixed.ts b/src/mol-io/reader/common/text/column/fixed.ts
index d279f3f2e..5b094506a 100644
--- a/src/mol-io/reader/common/text/column/fixed.ts
+++ b/src/mol-io/reader/common/text/column/fixed.ts
@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Column, ColumnHelpers } from 'mol-base/collections/database'
+import { Column, ColumnHelpers } from 'mol-data/db'
 import { trimStr, Tokens } from '../tokenizer'
 import { parseIntSkipLeadingWhitespace, parseFloatSkipLeadingWhitespace } from '../number-parser'
 
diff --git a/src/mol-io/reader/common/text/column/token.ts b/src/mol-io/reader/common/text/column/token.ts
index e4dd79fe3..21d8afd06 100644
--- a/src/mol-io/reader/common/text/column/token.ts
+++ b/src/mol-io/reader/common/text/column/token.ts
@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Column, ColumnHelpers } from 'mol-base/collections/database'
+import { Column, ColumnHelpers } from 'mol-data/db'
 import { Tokens } from '../tokenizer'
 import { parseInt as fastParseInt, parseFloat as fastParseFloat } from '../number-parser'
 
diff --git a/src/mol-io/reader/common/text/tokenizer.ts b/src/mol-io/reader/common/text/tokenizer.ts
index d8ddc0746..55b310e5d 100644
--- a/src/mol-io/reader/common/text/tokenizer.ts
+++ b/src/mol-io/reader/common/text/tokenizer.ts
@@ -6,7 +6,7 @@
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
 
-import Computation from 'mol-base/computation'
+import Computation from 'mol-util/computation'
 
 export interface Tokenizer {
     data: string,
diff --git a/src/mol-io/reader/gro/parser.ts b/src/mol-io/reader/gro/parser.ts
index 531a8b275..47e7ea192 100644
--- a/src/mol-io/reader/gro/parser.ts
+++ b/src/mol-io/reader/gro/parser.ts
@@ -5,12 +5,12 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Column } from 'mol-base/collections/database'
+import { Column } from 'mol-data/db'
 import Tokenizer from '../common/text/tokenizer'
 import FixedColumn from '../common/text/column/fixed'
 import * as Schema from './schema'
 import Result from '../result'
-import Computation from 'mol-base/computation'
+import Computation from 'mol-util/computation'
 
 interface State {
     tokenizer: Tokenizer,
diff --git a/src/mol-io/reader/gro/schema.d.ts b/src/mol-io/reader/gro/schema.d.ts
index bd871b6ff..9a0b1ca55 100644
--- a/src/mol-io/reader/gro/schema.d.ts
+++ b/src/mol-io/reader/gro/schema.d.ts
@@ -5,7 +5,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Column } from 'mol-base/collections/database'
+import { Column } from 'mol-data/db'
 
 export interface Header {
     title: string,
diff --git a/src/mol-io/reader/mol2/schema.d.ts b/src/mol-io/reader/mol2/schema.d.ts
index fbf458ce8..374b52d0d 100644
--- a/src/mol-io/reader/mol2/schema.d.ts
+++ b/src/mol-io/reader/mol2/schema.d.ts
@@ -4,7 +4,7 @@
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
 
-import { Column } from 'mol-base/collections/database'
+import { Column } from 'mol-data/db'
 
 // Full format http://chemyang.ccnu.edu.cn/ccb/server/AIMMS/mol2.pdf
 // there are many records but for now ignore (pass over) all but the following
diff --git a/src/mol-io/writer/cif/encoder.ts b/src/mol-io/writer/cif/encoder.ts
index ed7b05418..548adbf99 100644
--- a/src/mol-io/writer/cif/encoder.ts
+++ b/src/mol-io/writer/cif/encoder.ts
@@ -4,8 +4,8 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import Iterator from 'mol-base/collections/iterator'
-import { Column } from 'mol-base/collections/database'
+import Iterator from 'mol-data/iterator'
+import { Column } from 'mol-data/db'
 import Encoder from '../encoder'
 
 // TODO: support for "coordinate fields", make "coordinate precision" a parameter of the encoder
diff --git a/src/mol-io/writer/cif/encoder/binary.ts b/src/mol-io/writer/cif/encoder/binary.ts
index 54968e5fb..581795963 100644
--- a/src/mol-io/writer/cif/encoder/binary.ts
+++ b/src/mol-io/writer/cif/encoder/binary.ts
@@ -6,8 +6,8 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import Iterator from 'mol-base/collections/iterator'
-import { Column } from 'mol-base/collections/database'
+import Iterator from 'mol-data/iterator'
+import { Column } from 'mol-data/db'
 import encodeMsgPack from '../../../common/msgpack/encode'
 import {
     EncodedColumn, EncodedData, EncodedFile, EncodedDataBlock, EncodedCategory, ArrayEncoder, ArrayEncoding as E, VERSION
diff --git a/src/mol-io/writer/cif/encoder/text.ts b/src/mol-io/writer/cif/encoder/text.ts
index b07a54853..ef51b6424 100644
--- a/src/mol-io/writer/cif/encoder/text.ts
+++ b/src/mol-io/writer/cif/encoder/text.ts
@@ -6,8 +6,8 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Column } from 'mol-base/collections/database'
-import StringBuilder from 'mol-base/utils/string-builder'
+import { Column } from 'mol-data/db'
+import StringBuilder from 'mol-util/string-builder'
 import * as Enc from '../encoder'
 import Writer from '../../writer'
 
diff --git a/src/mol-base/geometry/grid-lookup.ts b/src/mol-math/geometry/grid-lookup.ts
similarity index 100%
rename from src/mol-base/geometry/grid-lookup.ts
rename to src/mol-math/geometry/grid-lookup.ts
diff --git a/src/mol-base/geometry/sphere.ts b/src/mol-math/geometry/sphere.ts
similarity index 100%
rename from src/mol-base/geometry/sphere.ts
rename to src/mol-math/geometry/sphere.ts
diff --git a/src/mol-base/geometry/transform.ts b/src/mol-math/geometry/transform.ts
similarity index 91%
rename from src/mol-base/geometry/transform.ts
rename to src/mol-math/geometry/transform.ts
index 4eb1d64c6..cf9aaa6d9 100644
--- a/src/mol-base/geometry/transform.ts
+++ b/src/mol-math/geometry/transform.ts
@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Mat4 } from '../math/linear-algebra-3d'
+import { Mat4 } from '../linear-algebra/3d'
 
 interface Transform extends Readonly<{
     transform: Mat4,
diff --git a/src/mol-base/graph/graph.ts b/src/mol-math/graph/graph.ts
similarity index 100%
rename from src/mol-base/graph/graph.ts
rename to src/mol-math/graph/graph.ts
diff --git a/src/mol-math/linear-algebra.ts b/src/mol-math/linear-algebra.ts
new file mode 100644
index 000000000..20ffdc270
--- /dev/null
+++ b/src/mol-math/linear-algebra.ts
@@ -0,0 +1,8 @@
+/**
+ * Copyright (c) 2017 mol* contributors, licensed under MIT, See LICENSE file for more info.
+ *
+ * @author David Sehnal <david.sehnal@gmail.com>
+ */
+
+export * from './linear-algebra/3d'
+export * from './linear-algebra/tensor'
\ No newline at end of file
diff --git a/src/mol-base/math/linear-algebra-3d.ts b/src/mol-math/linear-algebra/3d.ts
similarity index 98%
rename from src/mol-base/math/linear-algebra-3d.ts
rename to src/mol-math/linear-algebra/3d.ts
index 0f998a126..fccdb52b7 100644
--- a/src/mol-base/math/linear-algebra-3d.ts
+++ b/src/mol-math/linear-algebra/3d.ts
@@ -77,7 +77,7 @@ export namespace Mat4 {
         mat[15] = 1;
         return mat;
     }
-
+    
     export function ofRows(rows: number[][]): Mat4 {
         const out = zero();
         for (let i = 0; i < 4; i++) {
@@ -89,11 +89,14 @@ export namespace Mat4 {
         return out;
     }
 
+    const _id = identity();
+    export function isIdentity(m: Mat4, eps?: number) {
+        return areEqual(m, _id, typeof eps === 'undefined' ? EPSILON.Value : eps);
+    }
+
     export function areEqual(a: Mat4, b: Mat4, eps: number) {
         for (let i = 0; i < 16; i++) {
-            if (Math.abs(a[i] - b[i]) > eps) {
-                return false;
-            }
+            if (Math.abs(a[i] - b[i]) > eps) return false;
         }
         return true;
     }
diff --git a/src/mol-base/math/_spec/tensor.spec.ts b/src/mol-math/linear-algebra/_spec/tensor.spec.ts
similarity index 98%
rename from src/mol-base/math/_spec/tensor.spec.ts
rename to src/mol-math/linear-algebra/_spec/tensor.spec.ts
index 0d4541121..7a1780d1d 100644
--- a/src/mol-base/math/_spec/tensor.spec.ts
+++ b/src/mol-math/linear-algebra/_spec/tensor.spec.ts
@@ -4,8 +4,8 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import T from '../tensor'
-import { Mat4 } from '../linear-algebra-3d'
+import { Tensor as T } from '../tensor'
+import { Mat4 } from '../3d'
 
 describe('tensor', () => {
     it('vector', () => {
diff --git a/src/mol-base/math/tensor.ts b/src/mol-math/linear-algebra/tensor.ts
similarity index 82%
rename from src/mol-base/math/tensor.ts
rename to src/mol-math/linear-algebra/tensor.ts
index d77c82b05..e5a872b9e 100644
--- a/src/mol-base/math/tensor.ts
+++ b/src/mol-math/linear-algebra/tensor.ts
@@ -4,9 +4,11 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-interface Tensor extends Array<number> { '@type': 'tensor' }
+import { Mat4, Vec3, Vec4 } from './3d'
 
-namespace Tensor {
+export interface Tensor extends Array<number> { '@type': 'tensor' }
+
+export namespace Tensor {
     export type ArrayCtor = { new (size: number): ArrayLike<number> }
 
     export interface Space {
@@ -47,6 +49,32 @@ namespace Tensor {
     export function ColumnMajorMatrix(rows: number, cols: number, ctor?: ArrayCtor) { return Space([rows, cols], [1, 0], ctor); }
     export function RowMajorMatrix(rows: number, cols: number, ctor?: ArrayCtor) { return Space([rows, cols], [0, 1], ctor); }
 
+    export function toMat4(space: Space, data: Tensor): Mat4 {
+        if (space.rank !== 2) throw new Error('Invalid tensor rank');
+        const mat = Mat4.zero();
+        const d0 = Math.min(4, space.dimensions[0]), d1 = Math.min(4, space.dimensions[1]);
+        for (let i = 0; i < d0; i++) {
+            for (let j = 0; j < d1; j++) Mat4.setValue(mat, i, j, space.get(data, i, j));
+        }
+        return mat;
+    }
+
+    export function toVec3(space: Space, data: Tensor): Vec3 {
+        if (space.rank !== 1) throw new Error('Invalid tensor rank');
+        const vec = Vec3.zero();
+        const d0 = Math.min(3, space.dimensions[0]);
+        for (let i = 0; i < d0; i++) vec[i] = data[i];
+        return vec;
+    }
+
+    export function toVec4(space: Space, data: Tensor): Vec4 {
+        if (space.rank !== 1) throw new Error('Invalid tensor rank');
+        const vec = Vec4.zero();
+        const d0 = Math.min(4, space.dimensions[0]);
+        for (let i = 0; i < d0; i++) vec[i] = data[i];
+        return vec;
+    }
+
     function accessors(layout: Layout): { get: Space['get'], set: Space['set'] } {
         const { dimensions, axisOrderFastToSlow: ao } = layout;
         switch (dimensions.length) {
@@ -113,6 +141,4 @@ namespace Tensor {
         }
         return o;
     }
-}
-
-export default Tensor
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/src/mol-data/sequence/TODO b/src/mol-model/sequence/TODO
similarity index 100%
rename from src/mol-data/sequence/TODO
rename to src/mol-model/sequence/TODO
diff --git a/src/mol-data/structure.ts b/src/mol-model/structure.ts
similarity index 100%
rename from src/mol-data/structure.ts
rename to src/mol-model/structure.ts
diff --git a/src/mol-data/structure/_spec/atom-set.spec.ts b/src/mol-model/structure/_spec/atom-set.spec.ts
similarity index 99%
rename from src/mol-data/structure/_spec/atom-set.spec.ts
rename to src/mol-model/structure/_spec/atom-set.spec.ts
index 03ca32556..d77dd5e86 100644
--- a/src/mol-data/structure/_spec/atom-set.spec.ts
+++ b/src/mol-model/structure/_spec/atom-set.spec.ts
@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { OrderedSet } from 'mol-base/collections/integer'
+import { OrderedSet } from 'mol-data/int'
 import AtomSet from '../structure/atom/set'
 import Atom from '../structure/atom'
 
diff --git a/src/mol-data/structure/export/mmcif.ts b/src/mol-model/structure/export/mmcif.ts
similarity index 98%
rename from src/mol-data/structure/export/mmcif.ts
rename to src/mol-model/structure/export/mmcif.ts
index 64d86d66c..c5cf31063 100644
--- a/src/mol-data/structure/export/mmcif.ts
+++ b/src/mol-model/structure/export/mmcif.ts
@@ -4,8 +4,8 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Column, Table } from 'mol-base/collections/database'
-import Iterator from 'mol-base/collections/iterator'
+import { Column, Table } from 'mol-data/db'
+import Iterator from 'mol-data/iterator'
 import * as Encoder from 'mol-io/writer/cif'
 //import { mmCIF_Schema } from 'mol-io/reader/cif/schema/mmcif'
 import { Structure, Atom, AtomSet } from '../structure'
diff --git a/src/mol-data/structure/model.ts b/src/mol-model/structure/model.ts
similarity index 100%
rename from src/mol-data/structure/model.ts
rename to src/mol-model/structure/model.ts
diff --git a/src/mol-data/structure/model/format.ts b/src/mol-model/structure/model/format.ts
similarity index 100%
rename from src/mol-data/structure/model/format.ts
rename to src/mol-model/structure/model/format.ts
diff --git a/src/mol-data/structure/model/formats/mmcif.ts b/src/mol-model/structure/model/formats/mmcif.ts
similarity index 96%
rename from src/mol-data/structure/model/formats/mmcif.ts
rename to src/mol-model/structure/model/formats/mmcif.ts
index 7c0d947e6..24b91ee40 100644
--- a/src/mol-data/structure/model/formats/mmcif.ts
+++ b/src/mol-model/structure/model/formats/mmcif.ts
@@ -4,9 +4,9 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { newUUID } from 'mol-base/utils/uuid'
-import { Column, Table } from 'mol-base/collections/database'
-import { Interval, Segmentation } from 'mol-base/collections/integer'
+import UUID from 'mol-util/uuid'
+import { Column, Table } from 'mol-data/db'
+import { Interval, Segmentation } from 'mol-data/int'
 import Format from '../format'
 import Model from '../model'
 import * as Hierarchy from '../properties/hierarchy'
@@ -66,7 +66,7 @@ function getConformation({ data }: mmCIF_Format, bounds: Interval): Conformation
     const start = Interval.start(bounds), end = Interval.end(bounds);
     const { atom_site } = data;
     return {
-        id: newUUID(),
+        id: UUID.create(),
         atomId: Column.window(atom_site.id, start, end),
         occupancy: Column.window(atom_site.occupancy, start, end),
         B_iso_or_equiv: Column.window(atom_site.B_iso_or_equiv, start, end),
@@ -100,7 +100,7 @@ function createModel(format: mmCIF_Format, bounds: Interval, previous?: Model):
     }
     const hierarchyKeys = findHierarchyKeys(hierarchyData, hierarchySegments);
     return {
-        id: newUUID(),
+        id: UUID.create(),
         sourceData: format,
         modelNum: format.data.atom_site.pdbx_PDB_model_num.value(Interval.start(bounds)),
         hierarchy: { ...hierarchyData, ...hierarchyKeys, ...hierarchySegments },
diff --git a/src/mol-data/structure/model/model.ts b/src/mol-model/structure/model/model.ts
similarity index 95%
rename from src/mol-data/structure/model/model.ts
rename to src/mol-model/structure/model/model.ts
index c393d2452..c7a33db54 100644
--- a/src/mol-data/structure/model/model.ts
+++ b/src/mol-model/structure/model/model.ts
@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import UUID from 'mol-base/utils/uuid'
+import UUID from 'mol-util/uuid'
 import Format from './format'
 import HierarchyProperties from './properties/hierarchy'
 import ConformationProperties from './properties/conformation'
diff --git a/src/mol-data/structure/model/properties/computed.ts b/src/mol-model/structure/model/properties/computed.ts
similarity index 100%
rename from src/mol-data/structure/model/properties/computed.ts
rename to src/mol-model/structure/model/properties/computed.ts
diff --git a/src/mol-data/structure/model/properties/conformation.ts b/src/mol-model/structure/model/properties/conformation.ts
similarity index 88%
rename from src/mol-data/structure/model/properties/conformation.ts
rename to src/mol-model/structure/model/properties/conformation.ts
index c53ab0844..66a975d62 100644
--- a/src/mol-data/structure/model/properties/conformation.ts
+++ b/src/mol-model/structure/model/properties/conformation.ts
@@ -4,8 +4,8 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Column } from 'mol-base/collections/database'
-import UUID from 'mol-base/utils/uuid'
+import { Column } from 'mol-data/db'
+import UUID from 'mol-util/uuid'
 
 interface Conformation {
     id: UUID,
diff --git a/src/mol-data/structure/model/properties/format-specific.ts b/src/mol-model/structure/model/properties/format-specific.ts
similarity index 100%
rename from src/mol-data/structure/model/properties/format-specific.ts
rename to src/mol-model/structure/model/properties/format-specific.ts
diff --git a/src/mol-data/structure/model/properties/hierarchy.ts b/src/mol-model/structure/model/properties/hierarchy.ts
similarity index 95%
rename from src/mol-data/structure/model/properties/hierarchy.ts
rename to src/mol-model/structure/model/properties/hierarchy.ts
index a19de7fd5..f3bec187d 100644
--- a/src/mol-data/structure/model/properties/hierarchy.ts
+++ b/src/mol-model/structure/model/properties/hierarchy.ts
@@ -4,8 +4,8 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Column, Table } from 'mol-base/collections/database'
-import { Segmentation } from 'mol-base/collections/integer'
+import { Column, Table } from 'mol-data/db'
+import { Segmentation } from 'mol-data/int'
 import { mmCIF_Schema as mmCIF } from 'mol-io/reader/cif/schema/mmcif'
 import { ElementSymbol} from '../types'
 
diff --git a/src/mol-data/structure/model/properties/transforms.ts b/src/mol-model/structure/model/properties/transforms.ts
similarity index 100%
rename from src/mol-data/structure/model/properties/transforms.ts
rename to src/mol-model/structure/model/properties/transforms.ts
diff --git a/src/mol-data/structure/model/types.ts b/src/mol-model/structure/model/types.ts
similarity index 99%
rename from src/mol-data/structure/model/types.ts
rename to src/mol-model/structure/model/types.ts
index 4a90f04c9..d105c1f81 100644
--- a/src/mol-data/structure/model/types.ts
+++ b/src/mol-model/structure/model/types.ts
@@ -5,7 +5,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import BitFlags from 'mol-base/utils/bit-flags'
+import BitFlags from 'mol-util/bit-flags'
 
 const _esCache = (function () {
     const cache = Object.create(null);
diff --git a/src/mol-data/structure/model/utils/hierarchy-keys.ts b/src/mol-model/structure/model/utils/hierarchy-keys.ts
similarity index 97%
rename from src/mol-data/structure/model/utils/hierarchy-keys.ts
rename to src/mol-model/structure/model/utils/hierarchy-keys.ts
index cc0f4821a..c09484245 100644
--- a/src/mol-data/structure/model/utils/hierarchy-keys.ts
+++ b/src/mol-model/structure/model/utils/hierarchy-keys.ts
@@ -4,9 +4,9 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Column } from 'mol-base/collections/database'
+import { Column } from 'mol-data/db'
 import { Data, Segments, Keys } from '../properties/hierarchy'
-import { Interval, Segmentation } from 'mol-base/collections/integer'
+import { Interval, Segmentation } from 'mol-data/int'
 
 function getResidueId(comp_id: string, seq_id: number, ins_code: string) {
     return `${comp_id} ${seq_id} ${ins_code}`;
diff --git a/src/mol-data/structure/query.ts b/src/mol-model/structure/query.ts
similarity index 100%
rename from src/mol-data/structure/query.ts
rename to src/mol-model/structure/query.ts
diff --git a/src/mol-data/structure/query/generators.ts b/src/mol-model/structure/query/generators.ts
similarity index 99%
rename from src/mol-data/structure/query/generators.ts
rename to src/mol-model/structure/query/generators.ts
index 5846eee6b..12d43abc4 100644
--- a/src/mol-data/structure/query/generators.ts
+++ b/src/mol-model/structure/query/generators.ts
@@ -8,7 +8,7 @@ import Query from './query'
 import Selection from './selection'
 import P from './properties'
 import { Structure, AtomSet, Atom } from '../structure'
-import { OrderedSet, Segmentation } from 'mol-base/collections/integer'
+import { OrderedSet, Segmentation } from 'mol-data/int'
 
 export const all: Query = s => s;
 
diff --git a/src/mol-data/structure/query/predicates.ts b/src/mol-model/structure/query/predicates.ts
similarity index 100%
rename from src/mol-data/structure/query/predicates.ts
rename to src/mol-model/structure/query/predicates.ts
diff --git a/src/mol-data/structure/query/properties.ts b/src/mol-model/structure/query/properties.ts
similarity index 100%
rename from src/mol-data/structure/query/properties.ts
rename to src/mol-model/structure/query/properties.ts
diff --git a/src/mol-data/structure/query/query.ts b/src/mol-model/structure/query/query.ts
similarity index 100%
rename from src/mol-data/structure/query/query.ts
rename to src/mol-model/structure/query/query.ts
diff --git a/src/mol-data/structure/query/selection.ts b/src/mol-model/structure/query/selection.ts
similarity index 97%
rename from src/mol-data/structure/query/selection.ts
rename to src/mol-model/structure/query/selection.ts
index 57700f931..8504e4252 100644
--- a/src/mol-data/structure/query/selection.ts
+++ b/src/mol-model/structure/query/selection.ts
@@ -4,8 +4,8 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import Iterator from 'mol-base/collections/iterator'
-import HashSet from 'mol-base/collections/hash-set'
+import Iterator from 'mol-data/iterator'
+import HashSet from 'mol-data/util/hash-set'
 import { Structure, Atom, AtomSet } from '../structure'
 
 type Selection =
diff --git a/src/mol-data/structure/structure.ts b/src/mol-model/structure/structure.ts
similarity index 100%
rename from src/mol-data/structure/structure.ts
rename to src/mol-model/structure/structure.ts
diff --git a/src/mol-data/structure/structure/atom.ts b/src/mol-model/structure/structure/atom.ts
similarity index 96%
rename from src/mol-data/structure/structure/atom.ts
rename to src/mol-model/structure/structure/atom.ts
index ef57e121f..217bbb1eb 100644
--- a/src/mol-data/structure/structure/atom.ts
+++ b/src/mol-model/structure/structure/atom.ts
@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Tuple } from 'mol-base/collections/integer'
+import { Tuple } from 'mol-data/int'
 import Unit from './unit'
 import Structure from './structure'
 
diff --git a/src/mol-data/structure/structure/atom/set.ts b/src/mol-model/structure/structure/atom/set.ts
similarity index 96%
rename from src/mol-data/structure/structure/atom/set.ts
rename to src/mol-model/structure/structure/atom/set.ts
index 6abe38108..3ce250e24 100644
--- a/src/mol-data/structure/structure/atom/set.ts
+++ b/src/mol-model/structure/structure/atom/set.ts
@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { OrderedSet, SortedArray, Iterator } from 'mol-base/collections/integer'
+import { OrderedSet, SortedArray, Iterator } from 'mol-data/int'
 import Atom from '../atom'
 import * as Impl from './set/impl'
 import createBuilder, { Builder as AtomSetBuilder } from './set/builder'
diff --git a/src/mol-data/structure/structure/atom/set/builder.ts b/src/mol-model/structure/structure/atom/set/builder.ts
similarity index 95%
rename from src/mol-data/structure/structure/atom/set/builder.ts
rename to src/mol-model/structure/structure/atom/set/builder.ts
index bf756939e..fdda1a1c5 100644
--- a/src/mol-data/structure/structure/atom/set/builder.ts
+++ b/src/mol-model/structure/structure/atom/set/builder.ts
@@ -6,8 +6,8 @@
 
 import AtomSet from '../set'
 import Atom from '../../atom'
-import { OrderedSet } from 'mol-base/collections/integer'
-import { sortArray } from 'mol-base/collections/sort'
+import { OrderedSet } from 'mol-data/int'
+import { sortArray } from 'mol-data/util/sort'
 
 export class Builder {
     private keys: number[] = [];
diff --git a/src/mol-data/structure/structure/atom/set/impl.ts b/src/mol-model/structure/structure/atom/set/impl.ts
similarity index 99%
rename from src/mol-data/structure/structure/atom/set/impl.ts
rename to src/mol-model/structure/structure/atom/set/impl.ts
index 8c0f2bcd4..f60658f1f 100644
--- a/src/mol-data/structure/structure/atom/set/impl.ts
+++ b/src/mol-model/structure/structure/atom/set/impl.ts
@@ -4,9 +4,9 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { SortedArray, Interval, Iterator, OrderedSet } from 'mol-base/collections/integer'
-import { sortArray } from 'mol-base/collections/sort'
-import { hash1 } from 'mol-base/collections/hash-functions'
+import { SortedArray, Interval, Iterator, OrderedSet } from 'mol-data/int'
+import { sortArray } from 'mol-data/util/sort'
+import { hash1 } from 'mol-data/util/hash-functions'
 import Atom from '../../atom'
 
 /** Long and painful implementation starts here */
diff --git a/src/mol-data/structure/structure/atom/set/properties.ts b/src/mol-model/structure/structure/atom/set/properties.ts
similarity index 100%
rename from src/mol-data/structure/structure/atom/set/properties.ts
rename to src/mol-model/structure/structure/atom/set/properties.ts
diff --git a/src/mol-data/structure/structure/operator.ts b/src/mol-model/structure/structure/operator.ts
similarity index 91%
rename from src/mol-data/structure/structure/operator.ts
rename to src/mol-model/structure/structure/operator.ts
index e6fc2fd2f..10ba47cb8 100644
--- a/src/mol-data/structure/structure/operator.ts
+++ b/src/mol-model/structure/structure/operator.ts
@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { Mat4 } from 'mol-base/math/linear-algebra-3d'
+import { Mat4 } from 'mol-math/linear-algebra'
 
 interface Operator extends Readonly<{
     name: string,
diff --git a/src/mol-data/structure/structure/structure.ts b/src/mol-model/structure/structure/structure.ts
similarity index 95%
rename from src/mol-data/structure/structure/structure.ts
rename to src/mol-model/structure/structure/structure.ts
index 9b6c64720..0d09fa4db 100644
--- a/src/mol-data/structure/structure/structure.ts
+++ b/src/mol-model/structure/structure/structure.ts
@@ -4,8 +4,8 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import { OrderedSet, Iterator } from 'mol-base/collections/integer'
-import UniqueArray from 'mol-base/collections/unique-array'
+import { OrderedSet, Iterator } from 'mol-data/int'
+import UniqueArray from 'mol-data/util/unique-array'
 import { Model, Format } from '../model'
 import Unit from './unit'
 import Operator from './operator'
diff --git a/src/mol-data/structure/structure/unit.ts b/src/mol-model/structure/structure/unit.ts
similarity index 98%
rename from src/mol-data/structure/structure/unit.ts
rename to src/mol-model/structure/structure/unit.ts
index b58145ca2..c819836d9 100644
--- a/src/mol-data/structure/structure/unit.ts
+++ b/src/mol-model/structure/structure/unit.ts
@@ -6,7 +6,7 @@
 
 import { Model } from '../model'
 import Operator from './operator'
-import { Vec3, Mat4 } from 'mol-base/math/linear-algebra-3d'
+import { Vec3, Mat4 } from 'mol-math/linear-algebra'
 
 interface Unit extends Readonly<{
     // Structure-level unique identifier of the unit.
diff --git a/src/mol-data/volume/TODO b/src/mol-model/volume/TODO
similarity index 100%
rename from src/mol-data/volume/TODO
rename to src/mol-model/volume/TODO
diff --git a/src/mol-base/utils/_spec/string-builder.spec.ts b/src/mol-util/_spec/string-builder.spec.ts
similarity index 100%
rename from src/mol-base/utils/_spec/string-builder.spec.ts
rename to src/mol-util/_spec/string-builder.spec.ts
diff --git a/src/mol-base/utils/bit-flags.ts b/src/mol-util/bit-flags.ts
similarity index 100%
rename from src/mol-base/utils/bit-flags.ts
rename to src/mol-util/bit-flags.ts
diff --git a/src/mol-base/computation.ts b/src/mol-util/computation.ts
similarity index 99%
rename from src/mol-base/computation.ts
rename to src/mol-util/computation.ts
index d81b970a9..6bafb7a99 100644
--- a/src/mol-base/computation.ts
+++ b/src/mol-util/computation.ts
@@ -5,8 +5,8 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import Scheduler from './utils/scheduler'
-import timeNow from './utils/time'
+import Scheduler from './scheduler'
+import timeNow from './time'
 
 interface Computation<A> {
     (ctx?: Computation.Context): Promise<A>
diff --git a/src/mol-util/index.ts b/src/mol-util/index.ts
new file mode 100644
index 000000000..18a0aa3cd
--- /dev/null
+++ b/src/mol-util/index.ts
@@ -0,0 +1,14 @@
+/**
+ * Copyright (c) 2017 mol* contributors, licensed under MIT, See LICENSE file for more info.
+ *
+ * @author David Sehnal <david.sehnal@gmail.com>
+ */
+
+import BitFlags from './bit-flags'
+import Computation from './computation'
+import Scheduler from './scheduler'
+import StringBuilder from './string-builder'
+import Time from './time'
+import UUID from './uuid'
+
+export { BitFlags, Computation, Scheduler, StringBuilder, Time, UUID }
\ No newline at end of file
diff --git a/src/mol-base/utils/scheduler.ts b/src/mol-util/scheduler.ts
similarity index 100%
rename from src/mol-base/utils/scheduler.ts
rename to src/mol-util/scheduler.ts
diff --git a/src/mol-base/utils/string-builder.ts b/src/mol-util/string-builder.ts
similarity index 100%
rename from src/mol-base/utils/string-builder.ts
rename to src/mol-util/string-builder.ts
diff --git a/src/mol-base/utils/time.ts b/src/mol-util/time.ts
similarity index 100%
rename from src/mol-base/utils/time.ts
rename to src/mol-util/time.ts
diff --git a/src/mol-util/uuid.ts b/src/mol-util/uuid.ts
new file mode 100644
index 000000000..471d34969
--- /dev/null
+++ b/src/mol-util/uuid.ts
@@ -0,0 +1,23 @@
+/**
+ * Copyright (c) 2017 mol* contributors, licensed under MIT, See LICENSE file for more info.
+ *
+ * @author David Sehnal <david.sehnal@gmail.com>
+ */
+
+import now from './time'
+
+interface UUID extends String { '@type': 'uuid' }
+
+namespace UUID {
+    export function create(): UUID {
+        let d = (+new Date()) + now();
+        const uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
+            const r = (d + Math.random()*16)%16 | 0;
+            d = Math.floor(d/16);
+            return (c==='x' ? r : (r&0x3|0x8)).toString(16);
+        });
+        return uuid as any;
+    }
+}
+
+export default UUID;
\ No newline at end of file
diff --git a/src/perf-tests/chunked-array-vs-native.ts b/src/perf-tests/chunked-array-vs-native.ts
index 80fc3ff31..1b145425d 100644
--- a/src/perf-tests/chunked-array-vs-native.ts
+++ b/src/perf-tests/chunked-array-vs-native.ts
@@ -1,5 +1,5 @@
 import * as B from 'benchmark'
-import ChunkedArray from 'mol-base/collections/chunked-array'
+import ChunkedArray from 'mol-data/util/chunked-array'
 
 function testNative(size: number) {
     const xs = new Array(size);
diff --git a/src/perf-tests/cif-encoder.ts b/src/perf-tests/cif-encoder.ts
index 2b1193e3e..5f2250825 100644
--- a/src/perf-tests/cif-encoder.ts
+++ b/src/perf-tests/cif-encoder.ts
@@ -4,7 +4,7 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-import Iterator from 'mol-base/collections/iterator'
+import Iterator from 'mol-data/iterator'
 import * as Enc from 'mol-io/writer/cif'
 
 const category1: Enc.CategoryDefinition<number> = {
diff --git a/src/perf-tests/column.ts b/src/perf-tests/column.ts
index 0232e28e0..88ad89b35 100644
--- a/src/perf-tests/column.ts
+++ b/src/perf-tests/column.ts
@@ -1,5 +1,5 @@
 import * as B from 'benchmark'
-import { Column as C } from 'mol-base/collections/database'
+import { Column as C } from 'mol-data/db'
 
 export namespace Column {
     function createData(n: number) {
diff --git a/src/perf-tests/iterators.ts b/src/perf-tests/iterators.ts
index c98036308..a08ad0fc5 100644
--- a/src/perf-tests/iterators.ts
+++ b/src/perf-tests/iterators.ts
@@ -1,5 +1,5 @@
 import * as B from 'benchmark'
-import It from 'mol-base/collections/iterator'
+import It from 'mol-data/iterator'
 
 function createData(n: number) {
     const data = [];//new Int32Array(n);
diff --git a/src/perf-tests/sets.ts b/src/perf-tests/sets.ts
index 76d8c03c7..699c9037c 100644
--- a/src/perf-tests/sets.ts
+++ b/src/perf-tests/sets.ts
@@ -1,6 +1,6 @@
 import * as B from 'benchmark'
-import { Tuple, Segmentation, OrderedSet as OrdSet } from 'mol-base/collections/integer'
-import { AtomSet } from 'mol-data/structure/structure'
+import { Tuple, Segmentation, OrderedSet as OrdSet } from 'mol-data/int'
+import { AtomSet } from 'mol-model/structure'
 
 export namespace Iteration {
     const U = 1000, V = 2500;
diff --git a/src/perf-tests/sort.ts b/src/perf-tests/sort.ts
index d4461e91e..2c136f83e 100644
--- a/src/perf-tests/sort.ts
+++ b/src/perf-tests/sort.ts
@@ -1,5 +1,5 @@
 import * as B from 'benchmark'
-import * as Sort from 'mol-base/collections/sort'
+import * as Sort from 'mol-data/util'
 
 function shuffle(a: number[]) {
     for (let i = a.length - 1; i > 0; i--) {
diff --git a/src/perf-tests/string-builder.ts b/src/perf-tests/string-builder.ts
index 41b269c50..fa73eb600 100644
--- a/src/perf-tests/string-builder.ts
+++ b/src/perf-tests/string-builder.ts
@@ -1,5 +1,5 @@
 import * as B from 'benchmark'
-import SB from 'mol-base/utils/string-builder'
+import SB from 'mol-util/string-builder'
 
 export namespace Test {
     function createData(n: number) {
diff --git a/src/perf-tests/structure.ts b/src/perf-tests/structure.ts
index 801a98c79..62c780e59 100644
--- a/src/perf-tests/structure.ts
+++ b/src/perf-tests/structure.ts
@@ -10,10 +10,10 @@ import * as util from 'util'
 import * as fs from 'fs'
 import CIF from 'mol-io/reader/cif'
 
-import { Structure, Model, Queries as Q, Atom, AtomSet, Selection } from 'mol-data/structure'
-import { OrderedSet as OrdSet, Segmentation } from 'mol-base/collections/integer'
+import { Structure, Model, Queries as Q, Atom, AtomSet, Selection } from 'mol-model/structure'
+import { OrderedSet as OrdSet, Segmentation } from 'mol-data/int'
 
-import to_mmCIF from 'mol-data/structure/export/mmcif'
+import to_mmCIF from 'mol-model/structure/export/mmcif'
 
 require('util.promisify').shim();
 const readFileAsync = util.promisify(fs.readFile);
diff --git a/src/script.ts b/src/script.ts
index 05b1c962b..03c5d970a 100644
--- a/src/script.ts
+++ b/src/script.ts
@@ -15,9 +15,9 @@ const writeFileAsync = util.promisify(fs.writeFile);
 import Gro from 'mol-io/reader/gro/parser'
 import CIF from 'mol-io/reader/cif'
 
-import Computation from 'mol-base/computation'
+import Computation from 'mol-util/computation'
 
-import { Model } from 'mol-data/structure/model'
+import { Model } from 'mol-model/structure'
 
 // import { toTypedFrame as applySchema } from './reader/cif/schema'
 import { generateSchema } from 'mol-io/reader/cif/schema/utils'
diff --git a/tsconfig.json b/tsconfig.json
index d25a81888..c90e01741 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -13,9 +13,11 @@
         "outDir": "build/node_modules",
         "baseUrl": "src",
         "paths": {
-            "mol-base": ["./mol-base"],
-            "mol-data": ["./mol-data"],
-            "mol-io": ["./mol-io"]
+            "mol-util": ["./mol-util", "./mol-util/index.ts"],
+            "mol-data": ["./mol-data", "./mol-data/index.ts"],
+            "mol-math": ["./mol-math"],
+            "mol-io": ["./mol-io"],
+            "mol-model": ["./mol-model"]
         }
     },
     "include": [ "**/*" ]
-- 
GitLab