move code piecs to preinit/codeframe