Splitting the code a bit. Trying to simplify.