File restructure

No functional changes. Just moving the declarations of functions around.
I may be wrong in this, IE I don't know if declaration order matters in this, if it does, just reject my PR. Otherwise accepting it, would be good to help newbie coders to understand code flow a little easier.
HG created the emag_act() proc recently, so the comment really is just outdated at this point.