Code Api controller
Refactor fetching code method