Last of current refactoring based on feedback from Po Chen