added accept_local and accept_remote flags to give better control