Working mapper -- needs further adjustments and testing