Refactored main script to allow multiple commands.