Refactoring stub code