removing unused code and updating references