Remove all unused code, including helper functions