some work on the type system - probably wrong, but serves as examples.
merged