Split up code a bit