WIP extract code and test case