Now throw exception on key not found and null key.

Made some changes to return more meaningfull exceptions on incorrect
use.

Also changed to throw exception rather than null on not finding constant
based on key