added shared function