Make the code a bit more structured