Clean up code (format) and minor refactor