public static void main(String[] args) throws Exception {
        
        new File(System.getenv("APPDATA") + "\\.MinebookLauncher\\").mkdir();
        new File(System.getenv("APPDATA") + "\\.MinebookLauncher\\packs\\").mkdir();
        new File(System.getenv("APPDATA") + "\\.MinebookLauncher\\accessCodes\\").mkdir();
        
        programImage = ImageIO.read(new URL("http://shadowravengames.co.uk/images/launcherIcon.png"));
        frame.setIconImage(programImage);
        frame.setTitle("Minebook Launcher");
        
        File f = new File(System.getenv("APPDATA") + "\\.MinebookLauncher\\login");
        if( f.exists() ) {
            StringBuffer fileData = new StringBuffer(1000);
            BufferedReader reader = new BufferedReader(new FileReader(System.getenv("APPDATA") + "\\.MinebookLauncher\\login"));
            char[] buf = new char[1024];
            int numRead=0;
            while((numRead=reader.read(buf)) != -1){
                String readData = String.valueOf(buf, 0, numRead);
                fileData.append(readData);
                buf = new char[1024];
            }
            reader.close();
            String loginData = ProtectedLoginFile.main(fileData.toString(), "decrypt");
            if( loginData.contains(":") ) {
                String[] user = loginData.split(":");
                String sessionContent = LoginHandler.getContentResult(new URL("https://login.minecraft.net/?user=" + user[0] + "&password=" + user[1] + "&version=13"));
                String[] parts = sessionContent.split(":");
                
                frame.setIconImage(programImage);
                frame.setTitle("Minebook Launcher | " + parts[2].toString());
                        
                sessionID = parts[3].toString();
                loggedInUser = parts[2].toString();
                loginRemember.setSelected(true);
                loginAuto.setSelected(true);
            }else{
                loginUser.setText(loginData);
                loginRemember.setSelected(true);
            }
        }

        SpringLayout layout = new SpringLayout();
        
        frame.setBounds(new Rectangle(width, height));
        frame.setUndecorated(true);
        frame.setBackground(new Color(1.0f,1.0f,1.0f,0.0f));
        frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        centerWindow();

        JLabel background = new JLabel(new ImageIcon(new URL("http://modpacks.minebook.co.uk/images/frame.png")));
        background.setBackground(new Color(1.0f,1.0f,1.0f,0.0f));
        
        frame.setContentPane(background);

        logo.addMouseListener(new logoAction());
        logo.setIcon(new ImageIcon(new URL("http://modpacks.minebook.co.uk/images/logo.png")));
        logo.setBounds(0, 1, 133, 29);
        logo.setToolTipText("Goto minebook.co.uk!");
        logo.setVisible(true);

        ImageIcon userIMG = new ImageIcon(new URL("http://modpacks.minebook.co.uk/images/user.php?user=" + loggedInUser + ""));
        int imgWidth = userIMG.getIconWidth();
        user.setIcon(userIMG);
        user.addMouseListener(new userAction());
        user.setBounds(774-imgWidth, 1, imgWidth, 29);
        user.setVisible(true);
                
        profileBox.setBackground(Color.WHITE);
        profileBox.setBounds((852-300-11), 31, 300, 150);
        profileBox.setBorder(BorderFactory.createLineBorder(new Color(89, 61, 41)));
        profileBox.setVisible(false);
        profileBox.setLayout(layout);
        
        int imgDim = 128;
        
        userImage = new JLabel(new ImageIcon(new URL("http://minebook.co.uk/images/player.php?u=" + loggedInUser + "&s=" + imgDim)));
        userImage.setPreferredSize(new Dimension(imgDim, imgDim));
        userImage.setBorder(BorderFactory.createLineBorder(new Color(89, 61, 41)));
        
        JButton profileButton = new JButton("View your Profile");
        profileButton.addMouseListener(new userProfileAction());
        profileButton.setPreferredSize(new Dimension(140, 30));

        JButton editButton = new JButton("Edit your Profile");
        editButton.addMouseListener(new userEditAction());
        editButton.setPreferredSize(new Dimension(140, 30));

        JButton friendButton = new JButton("Add A Friend");
        friendButton.setPreferredSize(new Dimension(140, 30));
        
        JButton logoutButton = new JButton("Logout");
        logoutButton.setPreferredSize(new Dimension(140, 29));
        logoutButton.addMouseListener(new logoutAction());
                
        profileBox.add(userImage);
        profileBox.add(profileButton);
        profileBox.add(editButton);
        profileBox.add(friendButton);
        profileBox.add(logoutButton);
        
        layout.putConstraint(SpringLayout.WEST, userImage, 10, SpringLayout.WEST, profileBox);
        layout.putConstraint(SpringLayout.EAST, userImage, imgDim+10, SpringLayout.WEST, profileBox);
        layout.putConstraint(SpringLayout.NORTH, userImage, 10, SpringLayout.NORTH, profileBox);
        layout.putConstraint(SpringLayout.SOUTH, userImage, imgDim+10, SpringLayout.NORTH, profileBox);

        layout.putConstraint(SpringLayout.WEST, profileButton, imgDim + 20, SpringLayout.WEST, profileBox);
        layout.putConstraint(SpringLayout.NORTH, profileButton, 10, SpringLayout.NORTH, profileBox);

        layout.putConstraint(SpringLayout.WEST, editButton, imgDim + 20, SpringLayout.WEST, profileBox);
        layout.putConstraint(SpringLayout.NORTH, editButton, 43, SpringLayout.NORTH, profileBox);

        layout.putConstraint(SpringLayout.WEST, friendButton, imgDim + 20, SpringLayout.WEST, profileBox);
        layout.putConstraint(SpringLayout.NORTH, friendButton, 76, SpringLayout.NORTH, profileBox);

        layout.putConstraint(SpringLayout.WEST, logoutButton, imgDim + 20, SpringLayout.WEST, profileBox);
        layout.putConstraint(SpringLayout.NORTH, logoutButton, 109, SpringLayout.NORTH, profileBox);
        
        loginBox.setBackground(Color.WHITE);
        loginBox.setBounds((852-300-11), 31, 300, 150);
        loginBox.setBorder(BorderFactory.createLineBorder(new Color(89, 61, 41)));
        loginBox.setVisible(false);
        loginBox.setLayout(layout);
        
        JLabel loginUserText = new JLabel("Username: ");
        JLabel loginPasswordText = new JLabel("Password: ");
        loginMessage.setForeground(Color.RED);
        loginMessage.setHorizontalAlignment(SwingConstants.RIGHT);
        JButton loginButton = new JButton("Login");
        loginButton.addMouseListener(new loginAction());

        loginBox.add(loginUserText);
        loginBox.add(loginUser);
        loginBox.add(loginPasswordText);
        loginBox.add(loginPassword);
        loginBox.add(loginRemember);
        loginBox.add(loginAuto);
        loginBox.add(loginMessage);
        loginBox.add(loginButton);
        
        layout.putConstraint(SpringLayout.WEST, loginUserText, 40, SpringLayout.WEST, loginBox);
        layout.putConstraint(SpringLayout.NORTH, loginUserText, 10, SpringLayout.NORTH, loginBox);
        layout.putConstraint(SpringLayout.WEST, loginUser, 70, SpringLayout.WEST, loginUserText);
        layout.putConstraint(SpringLayout.EAST, loginUser, 160, SpringLayout.EAST, loginUserText);
        layout.putConstraint(SpringLayout.NORTH, loginUser, 0, SpringLayout.NORTH, loginUserText);
        layout.putConstraint(SpringLayout.WEST, loginPasswordText, 40, SpringLayout.WEST, loginBox);
        layout.putConstraint(SpringLayout.NORTH, loginPasswordText, 35, SpringLayout.NORTH, loginBox);
        layout.putConstraint(SpringLayout.WEST, loginPassword, 70, SpringLayout.WEST, loginPasswordText);
        layout.putConstraint(SpringLayout.EAST, loginPassword, 161, SpringLayout.EAST, loginPasswordText);
        layout.putConstraint(SpringLayout.NORTH, loginPassword, 0, SpringLayout.NORTH, loginPasswordText);
        layout.putConstraint(SpringLayout.WEST, loginRemember, 40, SpringLayout.WEST, loginBox);
        layout.putConstraint(SpringLayout.NORTH, loginRemember, 60, SpringLayout.NORTH, loginBox);
        layout.putConstraint(SpringLayout.WEST, loginAuto, 170, SpringLayout.WEST, loginBox);
        layout.putConstraint(SpringLayout.NORTH, loginAuto, 60, SpringLayout.NORTH, loginBox);
        layout.putConstraint(SpringLayout.WEST, loginMessage, 0, SpringLayout.WEST, loginUserText);
        layout.putConstraint(SpringLayout.EAST, loginMessage, 159, SpringLayout.EAST, loginUserText);
        layout.putConstraint(SpringLayout.NORTH, loginMessage, 90, SpringLayout.NORTH, loginBox);
        layout.putConstraint(SpringLayout.WEST, loginButton, 199, SpringLayout.WEST, loginBox);
        layout.putConstraint(SpringLayout.NORTH, loginButton, 113, SpringLayout.NORTH, loginBox);
        
        arrow.setIcon(new ImageIcon(new URL("http://modpacks.minebook.co.uk/images/arrow.png")));
        arrow.setBounds(774-imgWidth+(imgWidth/2)-5, 26, 11, 6);
        arrow.setVisible(false);
        
        minimize.addMouseListener(new minimizeAction());
        minimize.setIcon(new ImageIcon(new URL("http://modpacks.minebook.co.uk/images/minimize.png")));
        minimize.setBounds(width-80, 5, 20, 20);
        minimize.setVisible(true);

        maximize.setIcon(new ImageIcon(new URL("http://modpacks.minebook.co.uk/images/maximize.png")));
        maximize.setBounds(width-55, 5, 20, 20);
        maximize.setVisible(true);

        close.addMouseListener(new closeAction());
        close.setIcon(new ImageIcon(new URL("http://modpacks.minebook.co.uk/images/close.png")));
        close.setBounds(width-30, 5, 20, 20);
        close.setVisible(true);
        
        header.addMouseMotionListener(new headerAction());
        header.addMouseListener(new headerMAction());
        header.setBounds(0, 0, width, 30);
        header.setVisible(true);

        footer.setBounds(11, 462, 830, 20);
        footer.setForeground(Color.WHITE);
        footer.setVisible(true);
        
        frame.add(arrow);
        frame.add(profileBox);
        frame.add(loginBox);
        frame.add(logo);
        frame.add(user);
        frame.add(minimize);
        frame.add(maximize);
        frame.add(close);
        frame.add(footer);
        frame.add(header);
        
        
        JButton[] labels = getModPacks();

        int show = ( labels.length < 8 ) ? 8: labels.length;
        
        JPanel panel = new JPanel(new GridLayout( show, 1));
        panel.setBounds(0, 0, 295, (labels.length*20));
        panel.setPreferredSize(new Dimension(295, (labels.length*40)));

        panel.setBorder(null);
        panel.setBackground(new Color(0, 0, 0, 0f));
        panel.setVisible(true);
        JScrollPane scrollFrame = new JScrollPane(panel);
        panel.setAutoscrolls(true);
        scrollFrame.setBounds(10, 30, 301, height-60);
        scrollFrame.setBorder(null);
        scrollFrame.setVisible(true);
        
        URL fontUrl = new URL("http://fonts.mrvdog.in/f/DroidSans.ttf");
        Font rosemary = Font.createFont(Font.TRUETYPE_FONT, fontUrl.openStream()).deriveFont(Font.PLAIN, 16);
        
        frame.add(scrollFrame);
        
        for (int i=0;i<labels.length;i++) {
            labels[i].setPreferredSize(new Dimension(290, 50));
            labels[i].setSize(290, 50);
            labels[i].setFont(rosemary);
            labels[i].setVisible(true);
            String[] pt = labels[i].getToolTipText().split("-~-");
            labels[i].addMouseListener(new ModPackListener(pt[0], pt[1]));
            labels[i].setHorizontalAlignment(SwingConstants.LEFT);
            labels[i].setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
            labels[i].setBorderPainted(false);
            labels[i].setFocusPainted(false);
            labels[i].setRolloverEnabled(false);
            labels[i].setContentAreaFilled(false);
            labels[i].setFocusable(false);
            labels[i].setRequestFocusEnabled(false);
            labels[i].setBackground(new Color(0, 0, 0, 0f));
            labels[i].setForeground(new Color(255, 255, 255));
            panel.add(labels[i]);
        }
      
        if( args.length == 1 ) {
            frame.setVisible(true);
            String mcver = LoginHandler.getContentResult(new URL("http://modpacks.minebook.co.uk/packMcVer.php?packid=" + args[0]));
            new quickLaunch(args[0], mcver);
            System.out.println("Minebook QuickLaunch mode used! launching: " + args[0]);
        }else{
            frame.setVisible(true);
        }
       
    }