fixed tests, added new functionality