Some code structuring/reorganizing