Fix debug_all_tokens_for_user.

Change-Id: Ieb188d149f5fe964f980ecfaf37a40d1a6367cb2
Add test.

Change-Id: Id6ebcfd7e428051ac1c7ae5020952240a999d945
Refactor.

Change-Id: I4b84eede5ab274d351455b185d6fedd9e09c9ae7
Refactor.

Change-Id: Id33c3afec540667f07e8963b5a2e2a9949eb8402
Merge pull request #11 from tomwys/refactor-2

Refactor 2