Refactored libclient