rename functions, remove unused code.