IMO, that method needs to be revamped to allow easy extension and modification. But that is out of the focus of this PR.