added reply restriction
fixed minor bugs, added php docs to all functions