Refactor, mostly formatting