Refactor tree operations, using command pattern to reuse the
duplicate logic.
- Add CodeClimate support
- Add a new line at the end of each file