Merged code and added enter submit button binding