Add handler for individual apis
Refactoring, divide generation into 3 stages