First really working version (with client branch)