strip unused code, general cleanup