Added createElements() function