added tests, minor adjustments