some tests and refactor to support them (old stuff)