refactor & tidy