Everything looks good at first sight.

Corner cases to be tested.