Added tests, minor changes