rewrite of theme.js