Wip test, and some refactor