Wrap defines with braces and set better names
Split main function