Client module refactor. Random fixes.

This is XXL. Sorry about that.