Separate out code into a structure