made genX functions more flexible close #115