moved some functions from extern to static.
moved some functions from extern to static.