[INTERNAL] move code to cpp file