add types tests and adapt code