Some minor refactoruing and TypeRegister now also acceps json to simplify args