Reordered #includes, updated a comment and moved a variable to an inside scope