Rearranged Code

Rearranged code to improve on visibility