little refactor
Add tests