Moved element creation to PHP