working both add by button and add by enter keypress
refactored code - work the same way