private void init() {
		password = new PasswordField("Password:");
		password.setVisible(false);
		final VerticalLayout layout = (VerticalLayout) this.getContent();
        layout.setMargin(true);
        layout.setSpacing(true);
        password.setInputPrompt("Enter your password");
		password.setSizeFull();
		password.setRequired(true);
		password.setRequiredError("Please enter your account password");
        
        Label message = new Label("<b>We need your email address so you can save your work! (You'll be able to come back to it later)");
        message.setContentMode(Label.CONTENT_XHTML);
        message.setSizeUndefined();
        this.addComponent(message);

        final TextField emailField = new TextField();
        emailField.setInputPrompt("Enter your email address here");
        emailField.setSizeFull();
        emailField.setRequired(true);
        emailField.setRequiredError("Please enter a valid email address");
        emailField.addValidator(new FormEmailValidator(
                "The email address entered is not valid! (It should look like account@service.com)"));
        layout.addComponent(emailField);
        layout.addComponent(password);
        
        HorizontalLayout bottombar = new HorizontalLayout();
        
        final Button okay = new Button("OK");
        okay.addListener(new Button.ClickListener() {
            public void buttonClick(ClickEvent event) {
            	if (emailField.isValid()) {
            		if (!password.isVisible()) {
            			String[] returnValues = CloudMineStorage.userAccountStorage((String) emailField.getValue());
            			if (returnValues[0].equalsIgnoreCase("201")) {
    	            		//Account Created!
                			System.out.println("Account created and stored: " + emailField.getValue());
    	            		((Account)LoginWindow.this.getApplication().getUser()).setUsername((String) emailField.getValue());
    	            		sendEmail(returnValues[1]);
    	            		((Account)LoginWindow.this.getApplication().getUser()).setCloudMinePasswordHash(returnValues[1]);
    	            		((MainLayout)LoginWindow.this.getApplication().getMainWindow().getContent()).executeLastCommandBeforeLogin();
    	            		(LoginWindow.this.getParent()).removeWindow(LoginWindow.this);
                		}
                		else if (returnValues[0].equalsIgnoreCase("401")) {
                			//Account already existed! Prompt for credentials!
                			password.setVisible(true);
                			LoginWindow.this.setCaption("Your account exists! Please enter your account password!");
                		}
                		else if (returnValues[0].equalsIgnoreCase("400")) {
                			//Email address was invalid for some reason!
                			getWindow().showNotification(
                                    "Bad login attempt!",
                                    "The system had difficulty logging you in with your email address! " +
                                    "Click this box to try again.",
                                    Notification.TYPE_ERROR_MESSAGE);
                		}
            		}
            		else {
            			int responseCode = CloudMineStorage.userAccountStorage((String) emailField.getValue(), (String) password.getValue());
            			if (responseCode == 200) {
            				System.out.println(emailField.getValue() + " logged in successfully!");
    	            		((Account)LoginWindow.this.getApplication().getUser()).setUsername((String) emailField.getValue());
    	            		((Account)LoginWindow.this.getApplication().getUser()).setCloudMinePasswordHash((String) password.getValue());
    	            		((MainLayout)LoginWindow.this.getApplication().getMainWindow().getContent()).executeLastCommandBeforeLogin();
    	            		(LoginWindow.this.getParent()).removeWindow(LoginWindow.this);
            			}
            			else if (responseCode == 401) {
            				//Bad password!
            				getWindow().showNotification(
                                    "Bad login attempt!",
                                    "Your username (email address) and/or your password is incorrect! " +
                                    "Click this box to try again.",
                                    Notification.TYPE_ERROR_MESSAGE);
            			}
            			else if (responseCode == 400) {
            				//Email address was invalid for some reason!
            				getWindow().showNotification(
                                    "Bad login attempt!",
                                    "The system had difficulty logging you in with your email address! " +
                                    "Click this box to try again.",
                                    Notification.TYPE_ERROR_MESSAGE);
            			}
            			else {
            				System.out.println(responseCode);
            			}
            		}
            		
            	}
            }
        });
        
        final Button cancel = new Button("Cancel");
        cancel.addListener(new Button.ClickListener() {
			
			@Override
			public void buttonClick(ClickEvent event) {
				(LoginWindow.this.getParent()).removeWindow(LoginWindow.this);
			}
		});
        // The components added to the window are actually added to the window's
        // layout; you can use either. Alignments are set using the layout
        bottombar.addComponent(okay);
        bottombar.addComponent(cancel);
        layout.addComponent(bottombar);
        layout.setComponentAlignment(bottombar, Alignment.BOTTOM_CENTER);
        layout.setSizeUndefined();
	}