Speed optimization, bug fixes, enhanced type checker

- single attribute's assignment is optimized for speed
- implemented very lightweight type check in set. It's basically one
comparison with null.
- validation function is removed, implemented isValid method for nested
models/collections
- Collection.RefTo can be used to create subtypes of Collections.
- various little optimizations and code cleanup