Done: Wrap function into class; both client and server functions work