[tidy] move core function upfront