use types instead of global black magic
add types and type.tt