refactoring code to talkapp