renamed prikey
fixed a bug
completed the draft version
renewed the sql