Type factory formatting fix and add check for duplicate types

Signed-off-by: Aleksi Sapon <QcTechs@gmail.com>