Remove unused variable from function