added tests and working example