Fixed implementation and tests against feedback.