Created separated createElement method for output() method