 	
 	# Clean the database
 	generateClean: (next) ->
+		console.log 'Cleaning files'
+
+		timeoutCallback = ->
+			throw new Error 'Could not connect to the mongod'	
+		timeout = setTimeout timeoutCallback, 1500
+
 		async.parallel [
 			(callback) ->
 				docpad.LayoutModel.remove {}, (err) ->
 					throw err if err
-					console.log 'Cleaned Layouts'
+					console.log 'Cleaned layouts'
 					callback()
 			(callback) ->
 				docpad.DocumentModel.remove {}, (err) ->
 					throw err if err
-					console.log 'Cleaned Documents'
+					console.log 'Cleaned documents'
 					callback()
 		],
 		->
-			console.log 'Cleaned Files'
+			clearTimeout timeout
+			console.log 'Cleaned files'
 			next()
 	
 	# Parse the files

	# Generate
	generate: (next) ->
		# Check
		if docpad.genetating then return
		else docpad.generating = true

		# Continue
		path.exists docpad.options.srcPath, (exists) ->
			# Check
			if not exists then throw Error 'Cannot generate website as the src dir was not found'

			# Continue
			util.rmdir docpad.options.outPath, (err) ->
				throw err if err
				docpad.generateClean ->
					docpad.generateParse ->
						docpad.generateRelations ->

	
	# Watch
	watch: (next) ->
		# Log
		console.log 'Setting up watching...'
		
		# Watch the src directory
		watch.createMonitor docpad.options.srcPath, (monitor) ->
			# Log
			console.log 'Set up watching'

			# File Changed
			monitor.on 'changed', (fileFullPath,newStat,oldStat) ->
				docpad.generate ->
