change data source to factory, improve tests
add test for duration