Remove unused functions, make things local