Improvements implemented.
Client split up into a main class and a testable class.