refactor form elements logic and dropdown element