Huge code cleanup.

Removed unused code.
Some additions to userinfo class.