added automatic resize of elements