some changes. without new tests yet
one bug fixed and tests added