modified formattype.js