Bits of restructuring to make code more understandable / maintainable