How to refactor code to be more testableby@xiaoyunyang