Moves some functions into external calls