move the function inside