Modified example, added tests, small fixes