update with explanations and test cases