remove unused code and rename parameters