added dimensions/grid stuff. fixing type classes. other misc reorganization