Several test implementations; fixed tests caused by code improvement; code improvement according to new version of specification.