split up in lib and client