added tests and.. polished documentation