createElement

Move duplicated code into shared helper