moved the function outside community code