private void setUpRegister() {
		register = new JPanel();
		
		// Controls
		final JTextField firstname = new PlaceholderTextField("first name");
		final JTextField lastname = new PlaceholderTextField("last name");
		final JTextField username = new PlaceholderTextField("username");
		final JPasswordField password = new PlaceholderPasswordField("password");
		final JPasswordField cpassword = new PlaceholderPasswordField("confirm password");
		JButton submit = new JButton("Register");
		JButton cancel = new JButton("Cancel");

		JPanel centreBox = new JPanel();
		centreBox.setPreferredSize(new Dimension(200, 200));
		centreBox.setMinimumSize(new Dimension(200, 200));
		centreBox.setMaximumSize(new Dimension(200, 200));
		
		/*
		 * Add button listeners
		 */
		submit.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				RegisterRequest rq = new RegisterRequest();
				
				userId = username.getText();
				char[] pw = password.getPassword();
				char[] cpw = cpassword.getPassword();
				password.setText("");
				cpassword.setText("");
				byte[] hash;

				if (!Arrays.equals(pw, cpw)) {
					// Clear password arrays for extra security
					Arrays.fill(pw, '\0');
					Arrays.fill(cpw, '\0');
					Alerter.getHandler().warning("Registration",
							"Passwords did not match. Please try again.");
				} else {
					Arrays.fill(cpw, '\0');
					PasswordHasher ph = new PasswordHasher();
					hash = ph.preHash(userId, new String(pw));
					Arrays.fill(pw, '\0');
					
					rq.setSenderId(userId);
					rq.setPassword(hash);
					
					User user = new User();
					user.setFirstName(firstname.getText());
					user.setLastName(lastname.getText());
					rq.setUser(user);
	
					boolean success = Comms.sendMessage(rq);
	
					if (success) {
						// Receive response and handle
						try {
							RegisterResponse re = (RegisterResponse) Comms.receiveMessage();
							handle(re);
						} catch (ClassCastException ex) {
							Alerter.getHandler().severe("Authentication failure",
											"Response from server was malformed. Please try again.");
						}
					}
				}
			}
		});
		
		cancel.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				showLogin();
			}
		});
		
		// Layout code
		register.setLayout(new BoxLayout(register, BoxLayout.X_AXIS));
		register.add(Box.createHorizontalGlue());
		register.add(centreBox);
		register.add(Box.createHorizontalGlue());

		GroupLayout registerControlLayout = new GroupLayout(centreBox);
		registerControlLayout.setHorizontalGroup(registerControlLayout.createSequentialGroup()
			.addContainerGap()
			.addGroup(registerControlLayout.createParallelGroup()
				.addGroup(registerControlLayout.createSequentialGroup()
					.addComponent(firstname)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(lastname)
				)
				.addComponent(username)
				.addComponent(password)
				.addComponent(cpassword)
				.addGroup(registerControlLayout.createSequentialGroup()
					.addComponent(submit, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(cancel, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
				)
			)
			.addContainerGap()
		);
		registerControlLayout.setVerticalGroup(registerControlLayout.createSequentialGroup()
			.addGroup(registerControlLayout.createParallelGroup()
				.addComponent(firstname)
				.addComponent(lastname)
			)
			.addPreferredGap(ComponentPlacement.UNRELATED)
			.addComponent(username)
			.addPreferredGap(ComponentPlacement.RELATED)
			.addComponent(password)
			.addPreferredGap(ComponentPlacement.RELATED)
			.addComponent(cpassword)
			.addPreferredGap(ComponentPlacement.UNRELATED)
			.addGroup(registerControlLayout.createParallelGroup()
				.addComponent(submit)
				.addComponent(cancel)
			)
		);
		centreBox.setLayout(registerControlLayout);
	}