Starting to break up the code a little