refactor core, add test module