formatting and removing unused functions