Refactor current implementation.

This patches moves some files and introduces ITypeContainer.