Changed the order of build to allow for args.
Moved main to top.