 			options.loginIsBusy = userExists
 			options.user.username = request.body.username
 			options.user.password = request.body.password
-			response.render 'register', options
+			request.uonline.options = options
+			request.uonline.userCreated = false
+		next()
+	,
+	commit,
+	(request, response) ->
+		if request.uonline.userCreated
+			response.redirect 303, '/'
+		else
+			response.render 'register', request.uonline.options
 
 
 app.get '/character/',

app.get '/explode/', (request, response) ->
	throw new Error 'Emulated error.'

app.get '/explode_db/', (request, response) ->
	dbConnection.query.sync dbConnection, 'SELECT * FROM "Emulated DB error."'


app.get '/', (request, response) ->

app.post '/action/newCharacter',
	mustBeAuthed,
	setInstance('new_character'),
	openTransaction,
	(request, response, next) ->
		nameIsValid = lib.validation.characterNameIsValid(request.body.character_name)
		alreadyExists = lib.character.characterExists.sync(null, request.uonline.tx, request.body.character_name)

		if nameIsValid and not alreadyExists
			charid = lib.character.createCharacter.sync(
				null
				request.uonline.tx
				request.uonline.user.id
				request.body.character_name
				request.body.character_race
				request.body.character_gender
			)
			request.uonline.characterCreated = true
		else
			options = request.uonline
			options.error = true
			options.invalidName = !nameIsValid
			options.nameIsBusy = alreadyExists
			options.character_name = request.body.character_name
			request.uonline.options = options
			request.uonline.characterCreated = false
		next()
	,
	commit,
	(request, response) ->
		if request.uonline.characterCreated
			response.redirect 303, '/character/'
		else
			response.render 'new_character', request.uonline.options


app.get '/game/',
