Add helper function to avoid copy-paste code