Extracted method to reduce code dublication