Updated. Tests added.
comments updated