basic functional
fix functional
add tests