Added proper loggin with log4j and refactored the Client.