code tidy and some copy removal
fix merge conflict