refactor JS functionality and introduce new design elements