Move function to global space