Remove unused functions and cleanup code.