apply previous changes and remove unused code