cleanup and tests added.