I'd add comments here. just to make it more readable - took me more than a few seconds to follow this.