Adding a few comments for clarification. Adding some tests