Move misc function to single file

####Vastly Affect Change####
There are many little functions defined in main.h, I move them into misc.h (miscellaneous)
Actually the comment in main.cpp already said "move somewhere else" lol.
This is a vastly affected change, especially to files in components.