That is a bit too complicated for my liking. I think adding some comments could make this better understandable.