Refactored client for cleaner code. Refactored extensions as well.