Revert "Moved code around for legibility"

This reverts commit 46f2eb97b65c49fad47f58a45baa6d423ea6e20e.
Moved code around + Corrected linespacing bug