1. Change output name;
2. some minor refactoring;