 	ready = true
 	rounds = Db.shared.get 'rounds'
 	for round in rounds
+		log 'Phase:', round.phase
 		if round.phase in ['play', 'vote']
 			if round.waitingfor.length > 0
 				ready = false
 
+	log 'Ready:', JSON.stringify ready
 	if ready
 		log 'Should move on rounds now!'
 		exports.advanceRound()

		if not Db.shared.get 'rounds'
			Db.shared.set 'roundlength', 6
			exports.startgame()
			
		if config.roundlength and !isNaN +config.roundlength
			Db.shared.set 'roundlength', +config.roundlength
	else
		# Defaults for template groups

exports.onHttp = (request) ->
	db = {}
	db[0] = Db.shared.get()

	for uid in Plugin.userIds()
		db[uid] = Db.personal(uid).get()

	request.respond 200, JSON.stringify db

exports.onUpgrade = !->
	if not Db.shared.get 'roundlength'

Db = require 'db'
Event = require 'event'
Http = require 'http'
Plugin = require 'plugin'
Timer = require 'timer'
Util = require 'util'
