ticket:2 add some comments
ticket:2 add some test for writing to db