remove unused code and move leader to file top