callback url code refactoring