Create working function for typing text