refactor, reformat, remove stale code