Fixed lot of issues: encoding, performance, uniqueness in mapping discovery