arranging the code a bit