extracted construction of ui
refactored scripts