add some tests and data access logic