working copy of receive.c with commands. There might be minor bugs, will fix.
merge conflict