Improved code layout of Typecraft module.