merged with tests and corrected bug with gems string