 		id = generateUid()
 
 		# there's a 16^16 chance of conflicting, but hey
-		while fs.existsSync(path.join(@notebookdir, id))
+		while fs.existsSync(path.join(@notebookdir, id  + ".json"))
 			id = generateUid()
 
-		fs.mkdirSync(path.join(@notebookdir, id))
-		fs.writeFile path.join(@notebookdir, id, "meta.json"),
+		fs.writeFile path.join(@notebookdir, id + ".json"),
 			JSON.stringify {
 				id: id
 				name: name

	constructor: (@notebookdir) ->

	###
	# Creates a new notebook
	# @param {String} name The notebook name
	# @return {String} id The new notebook id

			}
		return id

	###
	# List notebooks
	# @return {Array} notebooks List of Notebooks
	###
	readNotebooks: ->
		files = fs.readdirSync @notebookdir
		notebooks = []

		files.forEach (file) ->
			notebooks.push file if file.substr(16,5) is ".json"

		return notebooks

	###
	# Read a notebook
	# @param {String} id The notebook id
	# @return {Object} notebook Notebook metadata with list of notes
	###

	###
	# Read a note
	# @param {String} id The note id
	# @return {Object} note Note metadata with content
	###

	###
	# Deletes a notebook
	# @param {String} id The notebook id
	###

	###
	# Deletes a note
	# @param {String} id The note id
	###
	deleteNote: (id) ->
		fs.unlink path.join(@notebookdir, @filenameNote(id))


noteddb = new db(notebookdir())
# notebook = noteddb.createNotebook("Getting Started")
# noteddb.createNote("Awesome", notebook, "YOLO SWAGGGG")
console.log noteddb.readNotebooks()
