fixed bugs, add writing to db, finished parsing