Works writing to database