public static void main(String[] args) {

        Scanner sysin = new Scanner(System.in);

        try {
            // reads the create command
            String command = sysin.next();
            if (!command.equals("create"))
                throw new IllegalArgumentException("UNKNOWN COMMAND");

            image = new CreateFactory().create(sysin).execute(null);

            initFactoryMap();

            // reads the next commands
            while (sysin.hasNext()) {
                Operation op = interpretNextCommand(sysin);
                if (op != null) {
                    stack.push(image);
                    image = op.execute(image);
                }
            }
        } catch (OperationException ex) {
            System.out.println("OPERATION FAILED");
        } catch (IllegalArgumentException ex) {
            if (ex.getMessage() != null)
                System.out.println(ex.getMessage());
            else
                System.out.println("INPUT MISMATCH");
            ex.printStackTrace();

        } catch (Exception ex) {
            ex.printStackTrace();
            System.out.println("INPUT MISMATCH");
        } finally {
            sysin.close();
        }
    }