remove unused variable and code reformat