update function finished in client.hpp, paste function refactored.