Refactored element matchers and added further tests and documentation.