Rewrote the main method to accept arguments.

I rewrote the main method completely with the comments in mind. This one should not have anything fishy with it. While at it, I replaced the old exception prints with RuntimeExceptions.