Change password take 2

This patch is making my head hurt. I seemed to think I did not need to unravel() inside the changePassword function, but after now attempting to do so, I get JSON exceptions like: "JSON.stringify cannot serialize cyclic structures." 

@ecto can you check out this branch and see what I am doing wrong?

(I am just trying to run the integration tests, and have commented out all others for now)
Trying to add a bit more 'type checking' to code as some bugs we have had in the past were due to not carefully chekcing arguments, etc