Though the code is quite clear, I would have added more docstrings to this.