avoid race condition by better modularization, adhoc interface created correctly