migrate all code to unit-test side