Some refactoring for common logic