Remove unused variable and some cleaning