added code for ui element initialization and layout