Reordered the code a little bit