final version
final version, added tests