Alternatives generation, little refactoring + tests