Refactored code.

I made some changes in an effort to improve the code. These are included: 
+Added success/fail handlers for all the source's actions.
+Added a unified way to get the euid from opts and rec.
+Added a unified way to generate localStorage keys.
*Code refactoring.
*Minor performance improvements.

If you would like you could use it and merge it with yours.