Some cleanup/refactoring of main method used for a sample request.