refactoring interceptors logic
extracting logic from interceptor