Rename function to better express what it does.
These functions should not be public.
Clean up some unused variables.