add handle for enter button in modals and some refactoring