Added few tests and polished the api. Still have some failing tests.