remove unused code and test segment