test: move some stuff around and add some tests