refactor arch and add unittests for utils