Update fixes #48. Passes test cases.