Create generic element factory method