Review changes, fixed some additional problems and added specific unit test.