Adding method to generate from string