add factory constructor
add tests