wrapper function to avoid duplicate code