revised
added partial tests