Ability to specify endpoint mappings.

Also fix a bug with safe id.
Merge pull request #12 from Baboom/master

Ability to specify endpoint mappings.