Extracting the common functionality