Added restrictCharacters function for user text input