public static void main(String[] args) {
        
        // args[0] application port
        // args[1] mode: "true" -> isManual, anyOther or missing -> not manual
        // args[2] number for setManualSpin
        
        // Checking and setting port number argument
        try {
            if (args.length > 0)
            {
                try {
                    portnumber = Integer.valueOf(args[0]);
                } catch (NumberFormatException e) {
                    System.out.println("Cannot parse the first parameter (port number). It should be an integer if given. The default port 9999 will be used");
                }
            }
            BASE_URI = BASE_URI.replaceFirst("portnumber", portnumber.toString());
            
            
            // Checking and setting "manual mode" argument and "number" argument 
            if (args.length > 1)
            {
                isManual = Boolean.valueOf(args[1]);
                if (isManual)
                {
                    Integer number = null;
                    if (args.length > 2)
                    {
                        try {
                            number = Integer.valueOf(args[2]);
                        } catch (NumberFormatException e) {
                            System.out.println("The third parameter should be an integer if given. Terminating");
                            System.exit(1);
                        }
                        
                    }
                    croupie.setManualSpin(true, number);
                    System.out.println("This Roulette application will run in manual mode without automatical spins");
                }
            }
            final HttpServer server = GrizzlyHttpServerFactory.createHttpServer(URI.create(BASE_URI), createApp());
            
            
            if (!isManual)
            {
            // Concurrent timer implementation
            final ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor();
            service.scheduleAtFixedRate(new Runnable() {
                @Override
                public void run() {
                    if (!server.isStarted())
                    {
                        // If the HTTP server is not running kill the Executor thread also
                        service.shutdown();
                    }
                    croupie.performGameMove();
                    
                }
            }, 10, 5, TimeUnit.SECONDS);
            
            }
            
            
            System.out.println("---------------------------------------------------");
            System.out.println("Listening URI is " + BASE_URI);
            System.out.println("Rules can be found on " + BASE_URI + "rules");
            System.out.println("Game stats can be obtained from " + BASE_URI + "stats");
            System.out.println("XML stats can be obtained from " + BASE_URI + "statsxml");
            System.out.println("The WADL file can be found on " + BASE_URI + "application.wadl");
            System.out.println(String.format("Application started.%nHit enter to stop it..."));
            System.out.println("---------------------------------------------------");
            
            System.in.read();
            server.stop();
        } catch (IOException ex) {
            Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
        }
    }